在start.spring.io上创建的工程,导入到idea,启动就退出,具体日志如下
"C:\Program Files (x86)\Java\jdk1.8.0_102\bin\java" "-javaagent:D:\Program Files (x86)\idea\IntelliJ IDEA Community Edition 2017.2.3\lib\idea_rt.jar=51805:D:\Program Files (x86)\idea\IntelliJ IDEA Community Edition 2017.2.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files (x86)\Java\jdk1.8.0_102\jre\lib\charsets.jar;C:\Program Files (x86)\Java\jdk1.8.0_102\jre\lib\deploy.jar;C:\Program Files (x86)\Java\jdk1.8.0_102\jre\lib\ext\access-bridge-32.jar;C:\Program Files (x86)\Java\jdk1.8.0_102\jre\lib\ext\cldrdata.jar;C:\Program Files (x86)\Java\jdk1.8.0_102\jre\lib\ext\dnsns.jar;C:\Program Files (x86)\Java\jdk1.8.0_102\jre\lib\ext\jaccess.jar;C:\Program Files (x86)\Java\jdk1.8.0_102\jre\lib\ext\jfxrt.jar;C:\Program Files (x86)\Java\jdk1.8.0_102\jre\lib\ext\localedata.jar;C:\Program Files (x86)\Java\jdk1.8.0_102\jre\lib\ext\nashorn.jar;C:\Program Files (x86)\Java\jdk1.8.0_102\jre\lib\ext\sunec.jar;C:\Program Files (x86)\Java\jdk1.8.0_102\jre\lib\ext\sunjce_provider.jar;C:\Program Files (x86)\Java\jdk1.8.0_102\jre\lib\ext\sunmscapi.jar;C:\Program Files (x86)\Java\jdk1.8.0_102\jre\lib\ext\sunpkcs11.jar;C:\Program Files (x86)\Java\jdk1.8.0_102\jre\lib\ext\zipfs.jar;C:\Program Files (x86)\Java\jdk1.8.0_102\jre\lib\javaws.jar;C:\Program Files (x86)\Java\jdk1.8.0_102\jre\lib\jce.jar;C:\Program Files (x86)\Java\jdk1.8.0_102\jre\lib\jfr.jar;C:\Program Files (x86)\Java\jdk1.8.0_102\jre\lib\jfxswt.jar;C:\Program Files (x86)\Java\jdk1.8.0_102\jre\lib\jsse.jar;C:\Program Files (x86)\Java\jdk1.8.0_102\jre\lib\management-agent.jar;C:\Program Files (x86)\Java\jdk1.8.0_102\jre\lib\plugin.jar;C:\Program Files (x86)\Java\jdk1.8.0_102\jre\lib\resources.jar;C:\Program Files (x86)\Java\jdk1.8.0_102\jre\lib\rt.jar;E:\zhang\idea_work\bootdemo\target\classes;D:\maven\repository\org\springframework\boot\spring-boot-starter\1.5.6.RELEASE\spring-boot-starter-1.5.6.RELEASE.jar;D:\maven\repository\org\springframework\boot\spring-boot\1.5.6.RELEASE\spring-boot-1.5.6.RELEASE.jar;D:\maven\repository\org\springframework\boot\spring-boot-autoconfigure\1.5.6.RELEASE\spring-boot-autoconfigure-1.5.6.RELEASE.jar;D:\maven\repository\org\springframework\spring-core\4.3.10.RELEASE\spring-core-4.3.10.RELEASE.jar;D:\maven\repository\org\yaml\snakeyaml\1.17\snakeyaml-1.17.jar;D:\maven\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;D:\maven\repository\log4j\log4j\1.2.17\log4j-1.2.17.jar;D:\maven\repository\org\springframework\spring-web\4.3.7.RELEASE\spring-web-4.3.7.RELEASE.jar;D:\maven\repository\org\springframework\spring-aop\4.3.10.RELEASE\spring-aop-4.3.10.RELEASE.jar;D:\maven\repository\org\springframework\spring-beans\4.3.10.RELEASE\spring-beans-4.3.10.RELEASE.jar;D:\maven\repository\org\springframework\spring-context\4.3.10.RELEASE\spring-context-4.3.10.RELEASE.jar;D:\maven\repository\org\springframework\spring-expression\4.3.10.RELEASE\spring-expression-4.3.10.RELEASE.jar" com.zhang.App2017-09-12 22:27:10,032 INFO App:17 - spring boot App is starting....... . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v1.5.6.RELEASE)2017-09-12 22:27:10,354 INFO App:48 - Starting App on philonic-PC with PID 46004 (E:\zhang\idea_work\bootdemo\target\classes started by Adminis in E:\zhang\idea_work\bootdemo)2017-09-12 22:27:10,355 INFO App:593 - No active profile set, falling back to default profiles: default2017-09-12 22:27:10,407 INFO AnnotationConfigApplicationContext:583 - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@18f65a4: startup date [Tue Sep 12 22:27:10 CST 2017]; root of context hierarchy2017-09-12 22:27:10,969 INFO AnnotationMBeanExporter:431 - Registering beans for JMX exposure on startup2017-09-12 22:27:10,981 INFO App:57 - Started App in 0.849 seconds (JVM running for 1.14)2017-09-12 22:27:10,981 INFO App:19 - spring boot App is running........2017-09-12 22:27:10,982 INFO AnnotationConfigApplicationContext:984 - Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@18f65a4: startup date [Tue Sep 12 22:27:10 CST 2017]; root of context hierarchy2017-09-12 22:27:10,983 INFO AnnotationMBeanExporter:449 - Unregistering JMX-exposed beans on shutdownProcess finished with exit code 0
网上有人说是因为缺少tomcat的jar依赖原因,pom文件加上下面代码就可以,亲自试验是可以解决问题的
org.springframework.boot spring-boot-starter-tomcat
另外发现把下面的spring-boot-starter
org.springframework.boot spring-boot-starter org.springframework.boot spring-boot-starter-logging
改为spring-boot-starter-web也是一种方法
org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-logging