java - How do I launch a Spring Boot application without the embedded tomcat? -
i have spring boot application generated using jhipster, , works fine. however, need create second application back-office batch jobs, , application uses of spring services of first application. did create second main class, starts spring boot application. problem starts embedded web-server , services useful web app. need services, persistence , other classes not tied gui.
here 2 main classes (simplified)
the normal spring-boot app:
@componentscan @autoconfigure class application { public static void main(string[] args) { springapplication app = new springapplication(application.class) app.run(args) } }
the back-office app:
@componentscan @autoconfigure class backofficeapplication { public static void main(string[] args) { springapplication app = new springapplication(backofficeapplication.class) app.run(args) } }
what works: office application has access need. spring services, beans, etc. problem: office app starts gui, preventing me launch twice @ same time.
is there way deactivate launching of embedded tomcat server? otherwise, there way load spring application context in way wouldn't start embedded server ?
some details: * don't start app using mvn spring-boot:run. launch class directly java (or using eclipse
springapplication
has property webenvironment
. defaults true if tomcat on classpath can set false (programmatically or spring.main.webenvironment
).
Comments
Post a Comment