springboot启动失败

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Mr_yangzc/article/details/81069330

springboot 从官网创建工程以后导入 idea中启动失败

spring


2018-07-16 18:00:13.908  INFO 12600 --- [           main] com.example.cas.CasApplication           : No active profile set, falling back to default profiles: default
2018-07-16 18:00:13.990  INFO 12600 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@533bda92: startup date [Mon Jul 16 18:00:13 CST 2018]; root of context hierarchy
2018-07-16 18:00:15.510  INFO 12600 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2018-07-16 18:00:15.531  INFO 12600 --- [           main] com.example.cas.CasApplication           : Started CasApplication in 2.181 seconds (JVM running for 3.036)
2018-07-16 18:00:15.534  INFO 12600 --- [       Thread-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@533bda92: startup date [Mon Jul 16 18:00:13 CST 2018]; root of context hierarchy
2018-07-16 18:00:15.536  INFO 12600 --- [       Thread-2] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown
Disconnected from the target VM, address: '127.0.0.1:59868', transport: 'socket'

查看pom.xml发现了一个奇特的现象 ,没有start.web


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>cas</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>cas</name>
    <description>Demo project for Spring Boot</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.3.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

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

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>


</project>

添加 jar包


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

看结果 启动成功


这里写图片描述

猜你喜欢

转载自blog.csdn.net/Mr_yangzc/article/details/81069330