Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I avoid Spring Boot from loading EmbeddedWebApplicationContext?

I have an Spring Boot integration application with Camel-HTTP. Since Camel-HTTP has a dependency to geronimo-servlet Spring Boot is trying to load the web application context.

How can I force Spring to not load the EmbeddedWebApplicationContext?

I have tried to exclude all the AutoConfiguration classes found in org.springframework.boot.autoconfigure.web with the @EnableAutoConfiguration(exclude = ...) annotation.

like image 790
victor.hernandez Avatar asked Mar 23 '15 09:03

victor.hernandez


1 Answers

You can use the SpringApplicationBuilder class to explicitly disable loading a web environment and context, i.e. in your main class:

public static void main(String[] args) {
    new SpringApplicationBuilder(MainConfig.class).web(false).run(args);
}
like image 135
adam p Avatar answered Oct 16 '22 09:10

adam p