Spring MVC – WebMvcConfigurerAdapter is deprecated

I migrated from Spring 3 to Spring 5 and found out the WebMvcConfigurerAdapter class is deprecated; what should we do? SpringWebConfig.java package com.mkyong.helloworld.config; import org.springframework.context.annotation.Bean; 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.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.view.InternalResourceViewResolver; import org.springframework.web.servlet.view.JstlView; @EnableWebMvc @Configuration @ComponentScan({ "com.mkyong.helloworld.web" }) public class SpringWebConfig extends WebMvcConfigurerAdapter { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) …

Read more

Spring Boot – Unable to find a @SpringBootConfiguration

Terminal Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=…) with your test The Spring Boot tests @SpringBootTest or @DataJpaTest need to find the @SpringBootConfiguration application class to launch the entire application and do the tests. And if Spring Boot can’t find the SpringBootConfiguration, it throws errors and stops the tests. A …

Read more