Migrate existing spring app to spring-boot, manually configure spring-boot? Migrate existing spring app to spring-boot, manually configure spring-boot? spring spring

Migrate existing spring app to spring-boot, manually configure spring-boot?


There is a chapter dedicated to Converting an existing application to Spring Boot in the Spring Boot reference guide.

Basically you need to add the Spring Boot dependencies and then implement the main entry point like this:

@SpringBootApplication@ImportResource("classpath:applicationContext.xml")public class MySpringBootApplication {    public static void main(String[] args) {        SpringApplication.run(MySpringBootApplication.class, args);    }}

However, this will also trigger Spring Boot's auto-configuration based upon (among other things) available classes and configured beans. You might want to disable certain auto-configurations. To exclude DataSource and Hibernate JPA auto-configuration, use:

@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class })