Performance: Embedded server concept
MEDIUM IMPACT
This concept affects the application startup time and runtime resource usage by bundling the server inside the app.
package com.example.demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); // Embedded Tomcat starts automatically } } // Application packaged as executable JAR with embedded Tomcat server
package com.example.demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; @SpringBootApplication public class DemoApplication extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(DemoApplication.class); } public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } } // Application packaged as a WAR and deployed to an external Tomcat server
| Pattern | Startup Time | Memory Usage | Deployment Complexity | Verdict |
|---|---|---|---|---|
| External server deployment (WAR) | Higher (5-10s+) | Lower (server shared) | Higher (server setup needed) | [! ] OK |
| Embedded server deployment (executable JAR) | Lower (2-5s) | Higher (server bundled) | Lower (self-contained) | [OK] Good |