Q:

Least intrusive way to add Spring task scheduling to a non-Spring web project?

How should I add Spring task scheduling to a non-Spring war project?  Currently, the web project only has a maven dependency to org.mitre.dsmiley.httpproxy:smiley-http-proxy-servlet.  It's just a simple proxy servlet now.  SpringBoot is probably not a good fit for this problem as I want to keep the war artifact the deployment model.  I do not want to run it embedded in a stand-alone container.  I'm looking for the least intrusive approach.  Any suggestions?

A:

If you are planning to deploy the app to a server that supports Servlet 3.0, then it is actually quite easy to use Spring Boot in a traditional, war deployment model.
What you need to do is:

Extend SpringBootServletInitializer, which in turn implements WebApplicationInitializer and can configure the servlet context.
Specify the war packaging in your pom.xml (which you probably already have)
Set the provided scope for the spring-boot-starter-tomcat dependency, so that an embedded server is not created when your application runs.

See the reference guide for more details.

