I'm writing a Spring Boot application that uses one of several @Configuration
classes depending on which @Profile
is set in the application.properties
file.
One of those Configuration classes uses a REST interface, and therefore I'm including spring-boot-starter-web
as a dependency.
This starts up an embedded Tomcat instance, which is fine.
The problem is, the other profiles don't need an embedded server (e.g. I'm using JMS to handle incoming messages instead of REST).
Is there any way to stop the @SpringBootApplication
from starting up Tomcat by default, and only using it for the REST Configuration class?
E.g., by annotating that class with @EnableWebMVC
Here's an example of my @Configuration
classes:
REST:
@Profile({"REST"})
@Configuration
@EnableWebMvc
public class HttpConfiguration{
.
.
.
}
JMS:
@Profile({"JMS"})
@Configuration
@EnableJms
public class JMSConfiguration{
.
.
.
}
Thanks