Spring Boot之HelloWorld

视频网址:http://www.iqiyi.com/w_19ruksbpf1.html

<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>edu.shy.javaee</groupId>
    <artifactId>sprint-boot-hello</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>sprint-boot-hello</name>
    <url>http://maven.apache.org</url>
    <!--sprint boot 父节点依赖,引入这个之后相关的引入就不需要加version配置,sprint boot 会自动选择最合适的版本进行添加 -->
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.4.0.BUILD-SNAPSHOT</version>
    </parent>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <!-- 指定一下jdk的版本,这里我们 使用jdk1.8,默认1.6 -->
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <!-- spring-boot-starter-web:MVC,AOP的依赖包 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-nop</artifactId>
            <version>1.7.24</version>
        </dependency>
    </dependencies>

    <!-- Package as an executable jar -->
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <!-- Add Spring repositories -->
    <!-- (you don't need this if you are using a .RELEASE version) -->
    <repositories>
        <repository>
            <id>spring-snapshots</id>
            <url>http://repo.spring.io/snapshot</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>spring-milestones</id>
            <url>http://repo.spring.io/milestone</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>spring-snapshots</id>
            <url>http://repo.spring.io/snapshot</url>
        </pluginRepository>
        <pluginRepository>
            <id>spring-milestones</id>
            <url>http://repo.spring.io/milestone</url>
        </pluginRepository>
    </pluginRepositories>

</project>

参考:https://blog.csdn.net/lxhjh/article/details/51711148

问题:Failed to load class "org.slf4j.impl.StaticLoggerBinder"

添加配置:

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-nop</artifactId>
            <version>1.7.24</version>
        </dependency>

参考:https://blog.csdn.net/qq_35923749/article/details/76735191

问题:Failed to start end point associated with ProtocalHandler [http-nio-8080] java.net.BindException:Address already in use :bind

SPRING-BOOT中TOMCAT端口修改
https://stackoverflow.com/questions/21083170/spring-boot-how-to-configure-port
https://www.cnblogs.com/h-ys/p/5470047.html

干掉进程中Java(TM) Platform SE binary

参考:https://www.cnblogs.com/onlycxue/p/3573154.html

或:

@Bean
public EmbeddedServletContainerFactory servletContainer(){
TomcatEmbeddedServletContainerFactory factory=new TomcatEmbeddedServletContainerFactory();
factory.setPort(8088);
factory.setSessionTimeout(10,TimeUnit.MINUTES);
//factory.addErrorPages(new ErrorPage(HttpStatus.Not_FOUND,"/notfund.html"));
return factory;
}

参考: 

https://www.cnblogs.com/zhao1949/p/6206417.html

 

 

 

spring boot
spring cloud
https://www.zhihu.com/question/39483566

posted @ 2018-05-10 11:05  BloggerSb  阅读(223)  评论(0编辑  收藏  举报