[STARTER] Spring Boot + Thymeleaf run on Tomcat 8

1. Application class [code language=”java”] package demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class Demo3Application { public static void main(String[] args) { SpringApplication.run(Demo3Application.class, args); } } [/code] 2. ServletInitializer [code language=”java”] package demo; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.web.SpringBootServletInitializer; public class ServletInitializer extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(Demo3Application.class); } } [/code] 3….

[SOLVED] Caused by: java.awt.HeadlessException when trying to create a SWING/AWT frame from Spring Boot

In Spring Boot, when you try to create a Swing frame from the component that is the entry point of your app, you will get [code]Caused by: java.awt.HeadlessException[/code] To solve this, in your Application class in main, instead of: [code] SpringApplication.run (Application.class, args) [/code] use [code] SpringApplicationBuilder builder = new SpringApplicationBuilder(Application.class); builder.headless(false); ConfigurableApplicationContext context =…