File tree Expand file tree Collapse file tree
spring-mvc-java/src/main/java/org/baeldung Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313@ Configuration
1414public class ClientWebConfig extends WebMvcConfigurerAdapter {
1515
16- public ClientWebConfig () {
17- super ();
18- }
16+ public ClientWebConfig () {
17+ super ();
18+ }
1919
20- // API
20+ // API
2121
22- @ Override
23- public void addViewControllers (final ViewControllerRegistry registry ) {
24- super .addViewControllers (registry );
22+ @ Override
23+ public void addViewControllers (final ViewControllerRegistry registry ) {
24+ super .addViewControllers (registry );
2525
26- registry .addViewController ("/sample.html" );
27- }
26+ registry .addViewController ("/sample.html" );
27+ }
2828
29- @ Bean
30- public ViewResolver viewResolver () {
31- final InternalResourceViewResolver bean = new InternalResourceViewResolver ();
29+ @ Bean
30+ public ViewResolver viewResolver () {
31+ final InternalResourceViewResolver bean = new InternalResourceViewResolver ();
3232
33- bean .setViewClass (JstlView .class );
34- bean .setPrefix ("/WEB-INF/view/" );
35- bean .setSuffix (".jsp" );
33+ bean .setViewClass (JstlView .class );
34+ bean .setPrefix ("/WEB-INF/view/" );
35+ bean .setSuffix (".jsp" );
3636
37- return bean ;
38- }
37+ return bean ;
38+ }
3939}
Original file line number Diff line number Diff line change 1+ package org .baeldung .spring .web .config ;
2+
3+ import org .springframework .context .annotation .ComponentScan ;
4+ import org .springframework .context .annotation .Configuration ;
5+ import org .springframework .web .servlet .config .annotation .EnableWebMvc ;
6+ import org .springframework .web .servlet .config .annotation .WebMvcConfigurerAdapter ;
7+
8+ @ Configuration
9+ @ EnableWebMvc
10+ @ ComponentScan ("org.baeldung.web" )
11+ public class WebConfig extends WebMvcConfigurerAdapter {
12+
13+ public WebConfig () {
14+ super ();
15+ }
16+
17+ // API
18+
19+ }
Original file line number Diff line number Diff line change 1+ package org .baeldung .web ;
2+
3+ import org .springframework .beans .factory .annotation .Autowired ;
4+ import org .springframework .stereotype .Component ;
5+
6+ @ Component
7+ public class BeanA {
8+
9+ @ Autowired
10+ private BeanB b ;
11+
12+ public BeanA () {
13+ super ();
14+ }
15+
16+ }
Original file line number Diff line number Diff line change 1+ package org .baeldung .web ;
2+
3+ public class BeanB {
4+
5+ public BeanB () {
6+ super ();
7+ }
8+
9+ }
You can’t perform that action at this time.
0 commit comments