Spring boot enable/disable embedded tomcat with profile

前端 未结 3 1645
囚心锁ツ
囚心锁ツ 2020-12-05 13:49

I\'m writing a Spring Boot application that uses one of several @Configuration classes depending on which @Profile is set in the application.

3条回答
  •  余生分开走
    2020-12-05 14:21

    The answers from @hzpz and @orid set me on the right track.

    I needed to add

    @SpringBootApplication(exclude = {EmbeddedServletContainerAutoConfiguration.class, 
    WebMvcAutoConfiguration.class})
    

    and set:

    spring.main.web-environment=false
    

    in my application.properties file for the non-Rest cases.

提交回复
热议问题