Spring启动失败

时间:2017-06-01 21:51:58

标签: spring-boot

我是Spring的新手,我写了一个spring应用程序。当我尝试启动应用程序时,它给我下面的日志但应用程序正在关闭。

如果我在这里做错了,你能帮助我吗?

2017-06-01 16:39:27.187  INFO 6040 --- [           main] com.slb.sims.flows.Application           : Starting Application on SLB-25QDSY1 with PID 6040 (D:\SLB\SpringPOCs\prjSpringJDBCWS\target\classes started by LTangirala in D:\SLB\SpringPOCs\prjSpringJDBCWS)
2017-06-01 16:39:27.191  INFO 6040 --- [           main] com.slb.sims.flows.Application           : No active profile set, falling back to default profiles: default
2017-06-01 16:39:27.313  INFO 6040 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@2c34f934: startup date [Thu Jun 01 16:39:27 CDT 2017]; root of context hierarchy
2017-06-01 16:39:28.448  INFO 6040 --- [           main] o.s.c.s.ClassPathXmlApplicationContext   : Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@2f16c6b3: startup date [Thu Jun 01 16:39:28 CDT 2017]; root of context hierarchy
2017-06-01 16:39:28.452  INFO 6040 --- [           main] o.s.b.f.xml.XmlBeanDefinitionReader      : Loading XML bean definitions from class path resource [applicationContext.xml]
2017-06-01 16:39:28.592  INFO 6040 --- [           main] o.s.j.d.DriverManagerDataSource          : Loaded JDBC driver: com.mysql.jdbc.Driver
2017-06-01 16:39:29.080  INFO 6040 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2017-06-01 16:39:29.095  INFO 6040 --- [           main] com.slb.sims.flows.Application           : Started Application in 2.342 seconds (JVM running for 3.083)
2017-06-01 16:39:29.096  INFO 6040 --- [       Thread-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@2c34f934: startup date [Thu Jun 01 16:39:27 CDT 2017]; root of context hierarchy
2017-06-01 16:39:29.098  INFO 6040 --- [       Thread-2] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown
Picked up _JAVA_OPTIONS: -Xmx1024M

2 个答案:

答案 0 :(得分:2)

在classpath中没有像Tomcat这样的嵌入式服务器。添加它,它将解决此问题 对于MAVEN,请在pom.xml中添加此依赖项

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>

对于Gradle(build.gradle)添加

dependencies {
    compile 'org.springframework.boot:spring-boot-starter-web'
}

答案 1 :(得分:1)

您需要将此依赖项添加到pom.xml中。 之后,它应该可以工作。

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>