Merge pull request #4499 from eugenp/update-all

update to spring 5, fix startup
This commit is contained in:
Loredana Crusoveanu 2018-06-17 21:25:02 +03:00 committed by GitHub
commit de66fb160c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 68 additions and 70 deletions

View File

@ -8,10 +8,10 @@
<packaging>war</packaging> <packaging>war</packaging>
<parent> <parent>
<artifactId>parent-boot-1</artifactId> <artifactId>parent-boot-2</artifactId>
<groupId>com.baeldung</groupId> <groupId>com.baeldung</groupId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-boot-1</relativePath> <relativePath>../parent-boot-2</relativePath>
</parent> </parent>
<dependencies> <dependencies>
@ -39,7 +39,6 @@
<dependency> <dependency>
<groupId>org.springframework.retry</groupId> <groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId> <artifactId>spring-retry</artifactId>
<version>${springretry.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.shell</groupId> <groupId>org.springframework.shell</groupId>
@ -55,11 +54,11 @@
<dependency> <dependency>
<groupId>org.hibernate</groupId> <groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId> <artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.javassist</groupId> <groupId>org.javassist</groupId>
<artifactId>javassist</artifactId> <artifactId>javassist</artifactId>
<version>${javassist.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>mysql</groupId> <groupId>mysql</groupId>
@ -74,6 +73,7 @@
<dependency> <dependency>
<groupId>org.hibernate</groupId> <groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId> <artifactId>hibernate-validator</artifactId>
<version>${hibernate.version}</version>
</dependency> </dependency>
<!-- web --> <!-- web -->
<dependency> <dependency>
@ -112,7 +112,6 @@
<dependency> <dependency>
<groupId>org.assertj</groupId> <groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId> <artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -139,17 +138,14 @@
<dependency> <dependency>
<groupId>org.ehcache</groupId> <groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId> <artifactId>ehcache</artifactId>
<version>${ehcache.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.logging.log4j</groupId> <groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId> <artifactId>log4j-api</artifactId>
<version>${log4j.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.logging.log4j</groupId> <groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId> <artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
@ -187,6 +183,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId> <artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
<configuration> <configuration>
<failOnMissingWebXml>false</failOnMissingWebXml> <failOnMissingWebXml>false</failOnMissingWebXml>
</configuration> </configuration>
@ -197,22 +194,23 @@
<properties> <properties>
<start-class>org.baeldung.sample.App</start-class> <start-class>org.baeldung.sample.App</start-class>
<!-- Spring --> <!-- Spring -->
<org.springframework.version>4.3.4.RELEASE</org.springframework.version> <org.springframework.version>5.0.6.RELEASE</org.springframework.version>
<org.springframework.security.version>4.2.0.RELEASE</org.springframework.security.version> <org.springframework.security.version>5.0.6.RELEASE</org.springframework.security.version>
<springretry.version>1.1.5.RELEASE</springretry.version> <springretry.version>1.2.2.RELEASE</springretry.version>
<org.springframework.shell.version>1.2.0.RELEASE</org.springframework.shell.version> <org.springframework.shell.version>1.2.0.RELEASE</org.springframework.shell.version>
<!-- persistence --> <!-- persistence -->
<hibernate.version>5.2.5.Final</hibernate.version> <hibernate.version>5.2.5.Final</hibernate.version>
<!-- util --> <!-- util -->
<guava.version>19.0</guava.version> <guava.version>25.1-jre</guava.version>
<ehcache.version>3.1.3</ehcache.version> <ehcache.version>3.5.2</ehcache.version>
<easymock.version>3.4</easymock.version> <easymock.version>3.6</easymock.version>
<assertj.version>3.6.1</assertj.version> <assertj.version>3.6.1</assertj.version>
<jasperreports.version>6.4.0</jasperreports.version> <jasperreports.version>6.6.0</jasperreports.version>
<log4j.version>2.8.2</log4j.version> <log4j.version>2.8.2</log4j.version>
<javassist.version>3.22.0-GA</javassist.version>
</properties> </properties>

View File

@ -4,9 +4,11 @@ import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.servlet.support.AbstractDispatcherServletInitializer; import org.springframework.web.servlet.support.AbstractDispatcherServletInitializer;
public class AnnotationsBasedApplicationAndServletInitializer extends AbstractDispatcherServletInitializer { public class AnnotationsBasedApplicationAndServletInitializer //extends AbstractDispatcherServletInitializer
{
@Override //uncomment to run the multiple contexts example
//@Override
protected WebApplicationContext createRootApplicationContext() { protected WebApplicationContext createRootApplicationContext() {
//If this is not the only class declaring a root context, we return null because it would clash //If this is not the only class declaring a root context, we return null because it would clash
//with other classes, as there can only be a single root context. //with other classes, as there can only be a single root context.
@ -17,19 +19,19 @@ public class AnnotationsBasedApplicationAndServletInitializer extends AbstractDi
return null; return null;
} }
@Override //@Override
protected WebApplicationContext createServletApplicationContext() { protected WebApplicationContext createServletApplicationContext() {
AnnotationConfigWebApplicationContext normalWebAppContext = new AnnotationConfigWebApplicationContext(); AnnotationConfigWebApplicationContext normalWebAppContext = new AnnotationConfigWebApplicationContext();
normalWebAppContext.register(NormalWebAppConfig.class); normalWebAppContext.register(NormalWebAppConfig.class);
return normalWebAppContext; return normalWebAppContext;
} }
@Override //@Override
protected String[] getServletMappings() { protected String[] getServletMappings() {
return new String[] { "/api/*" }; return new String[] { "/api/*" };
} }
@Override //@Override
protected String getServletName() { protected String getServletName() {
return "normal-dispatcher"; return "normal-dispatcher";
} }

View File

@ -4,9 +4,10 @@ import org.springframework.web.context.AbstractContextLoaderInitializer;
import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
public class AnnotationsBasedApplicationInitializer extends AbstractContextLoaderInitializer { public class AnnotationsBasedApplicationInitializer //extends AbstractContextLoaderInitializer
{
@Override //uncomment to run the multiple contexts example
// @Override
protected WebApplicationContext createRootApplicationContext() { protected WebApplicationContext createRootApplicationContext() {
AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
rootContext.register(RootApplicationConfig.class); rootContext.register(RootApplicationConfig.class);

View File

@ -12,9 +12,10 @@ import org.springframework.web.context.support.AnnotationConfigWebApplicationCon
import org.springframework.web.context.support.XmlWebApplicationContext; import org.springframework.web.context.support.XmlWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet; import org.springframework.web.servlet.DispatcherServlet;
public class ApplicationInitializer implements WebApplicationInitializer { public class ApplicationInitializer //implements WebApplicationInitializer
{
@Override //uncomment to run the multiple contexts example
//@Override
public void onStartup(ServletContext servletContext) throws ServletException { public void onStartup(ServletContext servletContext) throws ServletException {
//Here, we can define a root context and register servlets, among other things. //Here, we can define a root context and register servlets, among other things.
//However, since we've later defined other classes to do the same and they would clash, //However, since we've later defined other classes to do the same and they would clash,

View File

@ -5,14 +5,14 @@ import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.view.InternalResourceViewResolver; import org.springframework.web.servlet.view.InternalResourceViewResolver;
import org.springframework.web.servlet.view.JstlView; import org.springframework.web.servlet.view.JstlView;
@Configuration @Configuration
@EnableWebMvc @EnableWebMvc
@ComponentScan(basePackages = { "com.baeldung.contexts.normal" }) @ComponentScan(basePackages = { "com.baeldung.contexts.normal" })
public class NormalWebAppConfig extends WebMvcConfigurerAdapter { public class NormalWebAppConfig implements WebMvcConfigurer {
@Bean @Bean
public ViewResolver viewResolver() { public ViewResolver viewResolver() {

View File

@ -4,27 +4,29 @@ import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.servlet.support.AbstractDispatcherServletInitializer; import org.springframework.web.servlet.support.AbstractDispatcherServletInitializer;
public class SecureAnnotationsBasedApplicationAndServletInitializer extends AbstractDispatcherServletInitializer { public class SecureAnnotationsBasedApplicationAndServletInitializer// extends AbstractDispatcherServletInitializer
{
@Override //uncomment to run the multiple contexts example
//@Override
protected WebApplicationContext createRootApplicationContext() { protected WebApplicationContext createRootApplicationContext() {
return null; return null;
} }
@Override //@Override
protected WebApplicationContext createServletApplicationContext() { protected WebApplicationContext createServletApplicationContext() {
AnnotationConfigWebApplicationContext secureWebAppContext = new AnnotationConfigWebApplicationContext(); AnnotationConfigWebApplicationContext secureWebAppContext = new AnnotationConfigWebApplicationContext();
secureWebAppContext.register(SecureWebAppConfig.class); secureWebAppContext.register(SecureWebAppConfig.class);
return secureWebAppContext; return secureWebAppContext;
} }
@Override //@Override
protected String[] getServletMappings() { protected String[] getServletMappings() {
return new String[] { "/s/api/*" }; return new String[] { "/s/api/*" };
} }
@Override //@Override
protected String getServletName() { protected String getServletName() {
return "secure-dispatcher"; return "secure-dispatcher";
} }

View File

@ -5,14 +5,14 @@ import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.view.InternalResourceViewResolver; import org.springframework.web.servlet.view.InternalResourceViewResolver;
import org.springframework.web.servlet.view.JstlView; import org.springframework.web.servlet.view.JstlView;
@Configuration @Configuration
@EnableWebMvc @EnableWebMvc
@ComponentScan(basePackages = { "com.baeldung.contexts.secure" }) @ComponentScan(basePackages = { "com.baeldung.contexts.secure" })
public class SecureWebAppConfig extends WebMvcConfigurerAdapter { public class SecureWebAppConfig implements WebMvcConfigurer {
@Bean @Bean
public ViewResolver viewResolver() { public ViewResolver viewResolver() {

View File

@ -3,14 +3,12 @@ package com.baeldung.contexts.normal;
import java.util.Arrays; import java.util.Arrays;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.context.ContextLoader; import org.springframework.web.context.ContextLoader;
import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import com.baeldung.contexts.services.ApplicationContextUtilService;
import com.baeldung.contexts.services.GreeterService; import com.baeldung.contexts.services.GreeterService;
@Controller @Controller

View File

@ -4,28 +4,26 @@ import javax.servlet.ServletContext;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.ServletRegistration; import javax.servlet.ServletRegistration;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.web.WebApplicationInitializer; import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.ContextLoaderListener; import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.context.support.GenericWebApplicationContext; import org.springframework.web.context.support.GenericWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet; import org.springframework.web.servlet.DispatcherServlet;
public class StudentControllerConfig implements WebApplicationInitializer { public class StudentControllerConfig //implements WebApplicationInitializer
{
@Override //uncomment to run the student controller example
//@Override
public void onStartup(ServletContext sc) throws ServletException { public void onStartup(ServletContext sc) throws ServletException {
AnnotationConfigWebApplicationContext root = new AnnotationConfigWebApplicationContext(); AnnotationConfigWebApplicationContext root = new AnnotationConfigWebApplicationContext();
root.register(WebConfig.class); root.register(WebConfig.class);
root.setServletContext(sc); root.setServletContext(sc);
sc.addListener(new ContextLoaderListener(root));
//Manages the lifecycle of the root application context. DispatcherServlet dv = new DispatcherServlet(root);
//Conflicts with other root contexts in the application, so we've manually set the parent below.
//sc.addListener(new ContextLoaderListener(root));
GenericWebApplicationContext webApplicationContext = new GenericWebApplicationContext();
webApplicationContext.setParent(root);
DispatcherServlet dv = new DispatcherServlet(webApplicationContext);
ServletRegistration.Dynamic appServlet = sc.addServlet("test-mvc", dv); ServletRegistration.Dynamic appServlet = sc.addServlet("test-mvc", dv);
appServlet.setLoadOnStartup(1); appServlet.setLoadOnStartup(1);

View File

@ -6,13 +6,13 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.view.InternalResourceViewResolver; import org.springframework.web.servlet.view.InternalResourceViewResolver;
@Configuration @Configuration
@EnableWebMvc @EnableWebMvc
@ComponentScan(basePackages = { "org.baeldung.controller.controller", "org.baeldung.controller.config" }) @ComponentScan(basePackages = { "org.baeldung.controller.controller", "org.baeldung.controller.config" })
public class WebConfig extends WebMvcConfigurerAdapter { public class WebConfig implements WebMvcConfigurer {
@Override @Override
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
configurer.enable(); configurer.enable();

View File

@ -8,11 +8,11 @@ import java.util.concurrent.TimeUnit;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration @Configuration
@ComponentScan("org.baeldung.core") @ComponentScan("org.baeldung.core")
public class CoreConfig extends WebMvcConfigurerAdapter { public class CoreConfig implements WebMvcConfigurer {
public CoreConfig() { public CoreConfig() {
super(); super();

View File

@ -6,13 +6,16 @@ import javax.servlet.ServletContext;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.ServletRegistration; import javax.servlet.ServletRegistration;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.web.WebApplicationInitializer; import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.ContextLoaderListener; import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.context.support.GenericWebApplicationContext; import org.springframework.web.context.support.GenericWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet; import org.springframework.web.servlet.DispatcherServlet;
public class MainWebAppInitializer implements WebApplicationInitializer { public class MainWebAppInitializer implements WebApplicationInitializer
{
/** /**
* Register and configure all Servlet container components necessary to power the web application. * Register and configure all Servlet container components necessary to power the web application.
@ -26,14 +29,11 @@ public class MainWebAppInitializer implements WebApplicationInitializer {
root.scan("org.baeldung.spring.config"); root.scan("org.baeldung.spring.config");
// root.getEnvironment().setDefaultProfiles("embedded"); // root.getEnvironment().setDefaultProfiles("embedded");
//Manages the lifecycle of the root application context. sc.addListener(new ContextLoaderListener(root));
//Conflicts with other root contexts in the application, so we've manually set the parent below.
//sc.addListener(new ContextLoaderListener(root));
// Handles requests into the application DispatcherServlet dv = new DispatcherServlet(root);
GenericWebApplicationContext webApplicationContext = new GenericWebApplicationContext();
webApplicationContext.setParent(root); final ServletRegistration.Dynamic appServlet = sc.addServlet("mvc",dv);
final ServletRegistration.Dynamic appServlet = sc.addServlet("mvc", new DispatcherServlet(webApplicationContext));
appServlet.setLoadOnStartup(1); appServlet.setLoadOnStartup(1);
final Set<String> mappingConflicts = appServlet.addMapping("/"); final Set<String> mappingConflicts = appServlet.addMapping("/");
if (!mappingConflicts.isEmpty()) { if (!mappingConflicts.isEmpty()) {

View File

@ -5,13 +5,13 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.view.InternalResourceViewResolver; import org.springframework.web.servlet.view.InternalResourceViewResolver;
import org.springframework.web.servlet.view.JstlView; import org.springframework.web.servlet.view.JstlView;
@EnableWebMvc @EnableWebMvc
@Configuration @Configuration
public class MvcConfig extends WebMvcConfigurerAdapter { public class MvcConfig implements WebMvcConfigurer {
public MvcConfig() { public MvcConfig() {
super(); super();
@ -21,8 +21,6 @@ public class MvcConfig extends WebMvcConfigurerAdapter {
@Override @Override
public void addViewControllers(final ViewControllerRegistry registry) { public void addViewControllers(final ViewControllerRegistry registry) {
super.addViewControllers(registry);
registry.addViewController("/sample.html"); registry.addViewController("/sample.html");
} }

View File

@ -11,8 +11,8 @@ import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor; import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor;
import org.springframework.jdbc.datasource.DriverManagerDataSource; import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.orm.hibernate4.HibernateTransactionManager; import org.springframework.orm.hibernate5.HibernateTransactionManager;
import org.springframework.orm.hibernate4.LocalSessionFactoryBean; import org.springframework.orm.hibernate5.LocalSessionFactoryBean;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;

View File

@ -38,7 +38,7 @@ public class ScopesConfig {
} }
@Bean @Bean
@Scope(value = WebApplicationContext.SCOPE_GLOBAL_SESSION, proxyMode = ScopedProxyMode.TARGET_CLASS) @Scope(value = WebApplicationContext.SCOPE_APPLICATION, proxyMode = ScopedProxyMode.TARGET_CLASS)
public HelloMessageGenerator globalSessionMessage() { public HelloMessageGenerator globalSessionMessage() {
return new HelloMessageGenerator(); return new HelloMessageGenerator();
} }

View File

@ -6,13 +6,13 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.view.InternalResourceViewResolver; import org.springframework.web.servlet.view.InternalResourceViewResolver;
@Configuration @Configuration
@ComponentScan @ComponentScan
@EnableWebMvc @EnableWebMvc
public class AttributeAnnotationConfiguration extends WebMvcConfigurerAdapter { public class AttributeAnnotationConfiguration implements WebMvcConfigurer {
@Bean @Bean
public ViewResolver viewResolver() { public ViewResolver viewResolver() {