Launch Spring Boot Headless

I have a spring boot application and I would like to run it without a head. When I run from the terminal, this is the command I use:

java -jar myapp.jar - spring.main.headless = true

It is right? Any help is appreciated.

0
spring boot
source share
3 answers

I ran into the same problem and solved it using the SpringApplicationBuilder class. You must set headless false (which is true by default). See javadoc .

My main method is as follows:

  public static void main(String[] args) { SpringApplicationBuilder builder = new SpringApplicationBuilder(App.class); builder.headless(false).run(args); } 
+6
source share

In fact, SpringApplication supports SpringApplication mode [1], what you have should work, but not necessary, since true already by default.

[1] https://github.com/spring-projects/spring-boot/blob/v1.0.2.RELEASE/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java#L691-L998

+1
source share

spring.main.* Properties are introduced in SpringApplication . He knows nothing about heads or headlessness. Maybe you need java -Djava.awt.headless=true ... ?

0
source share

All Articles