0

I have a Spring boot app with different profiles with their own yaml configurations. My app is a web application with embedded tomcat serving rest requests.

I have a certain profile and when I activate it, it only scans certain packages. I want my app to terminate after the beans under those packages finish their jobs. However, spring-boot-starter-web may be blocking this since it keeps the app running to serve requests. Basically I'm trying to turn my web app into a console app (do the job then terminate) with a profile change.

For this, I tried excluding some autoconfigurations of spring-boot-starter-web but did not work, the app stil does not terminate:

spring:
  autoconfigure:
    exclude:
      - org.springframework.boot.autoconfigure.web.embedded.EmbeddedWebServerFactoryCustomizerAutoConfiguration

...

Can you help me achieve this?

Thank you

  • 2
    Just add `spring.main.web-application-type=none` as a property for that specific profile. See https://stackoverflow.com/questions/32078015/spring-boot-enable-disable-embedded-tomcat-with-profile – M. Deinum Jul 08 '21 at 11:35

0 Answers0