exception work

This commit is contained in:
eugenp 2013-05-24 21:36:46 +03:00
parent e85fd01d61
commit 144ce58d76
4 changed files with 61 additions and 17 deletions

View File

@ -13,27 +13,27 @@ import org.springframework.web.servlet.view.JstlView;
@Configuration @Configuration
public class ClientWebConfig extends WebMvcConfigurerAdapter { public class ClientWebConfig extends WebMvcConfigurerAdapter {
public ClientWebConfig() { public ClientWebConfig() {
super(); super();
} }
// API // API
@Override @Override
public void addViewControllers(final ViewControllerRegistry registry) { public void addViewControllers(final ViewControllerRegistry registry) {
super.addViewControllers(registry); super.addViewControllers(registry);
registry.addViewController("/sample.html"); registry.addViewController("/sample.html");
} }
@Bean @Bean
public ViewResolver viewResolver() { public ViewResolver viewResolver() {
final InternalResourceViewResolver bean = new InternalResourceViewResolver(); final InternalResourceViewResolver bean = new InternalResourceViewResolver();
bean.setViewClass(JstlView.class); bean.setViewClass(JstlView.class);
bean.setPrefix("/WEB-INF/view/"); bean.setPrefix("/WEB-INF/view/");
bean.setSuffix(".jsp"); bean.setSuffix(".jsp");
return bean; return bean;
} }
} }

View File

@ -0,0 +1,19 @@
package org.baeldung.spring.web.config;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
@EnableWebMvc
@ComponentScan("org.baeldung.web")
public class WebConfig extends WebMvcConfigurerAdapter {
public WebConfig() {
super();
}
// API
}

View File

@ -0,0 +1,16 @@
package org.baeldung.web;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class BeanA {
@Autowired
private BeanB b;
public BeanA() {
super();
}
}

View File

@ -0,0 +1,9 @@
package org.baeldung.web;
public class BeanB {
public BeanB() {
super();
}
}