Frühling Boot Nicht-Web-Anwendung, zu deaktivieren, wenn die Diskussion unter Fehlern unten Art und Weiseüber Federverschluß, wie Web-Umgebung richtig
new SpringApplication().setWebEnvironment(false);
es
dann noch habe ich
Caused by: org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getEmbeddedServletContainerFactory(EmbeddedWebApplicationContext.java:185) ~[spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
Dann versucht hat, oben beginnen Error.
versucht Dann
@SpringBootApplication(exclude={SpringDataWebAutoConfiguration.class})
aber immer noch die gleichen Fehler.
Endlich habe ich versucht, in application.properties
spring.main.web-environment=false
diesmal funktioniert es unter Konfiguration hinzuzufügen.
Warum die ersten beiden Arten können nicht funktionieren?
Beitrag der eigentliche Code nicht einen Schnipsel ... Es sind mehr Zeilen in Ihrer 'Haupt' Methode. Also poste die Anwendungsklasse. –
Versuchen Sie, diese '@SpringBootApplication (exclude = {EmbeddedServletContainerAutoConfiguration.class, WebMvcAutoConfiguration.class})' als [Empfohlene hier] (http://stackoverflow.com/questions/32078015/spring-boot-enable-disable-embedded -tomcat-with-profile) –
@SanjayRawat immer noch nicht funktionieren, siehe https://github.com/zhugw/spring-boot-disable-web-environment – zhuguowei