Migration of Spring MVC to Boot
-----------------------------------------------
-----------------------------------------------
- Import the configuration files of your Spring MVC App in Main class from which you initialise Spring boot application. This would ensure that you have the necessary configuration rightly initialised. Java Configurations could just be imported with @Import. With XML configurations, use @ImportXml
- If you are using servlet Api Version < 3 in MVC App i,e you have web.xml, then you need to put it in the webapp folder of the project which contains Spring Boot Main class. If Servlet API Version is > 3, then you just put the Spring boot MVC annotations on the class and Import it in main configuration class.
Example:
@ComponentScan
@EnableAutoConfiguration
@Import(ScheduledTasks.class)
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
No comments:
Post a Comment