• 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

  • 相关阅读:
    thinkphp中ajax使用实例(thinkphp内置支持ajax)
    Uncaught SyntaxError: Invalid regular expression flags(看页面源代码)
    php函数实现显示几秒前,几分钟前,几天前等方法(网络上什么都有)
    php实现二叉树遍历
    php实现数组中的逆序对(归并排序实现:排序 辅助数组)
    基于HTML5气3D仿真培训系统
    CSDN Androidclient生产 导航帖
    MongoDB日常保养
    Machine Learning—Linear Regression
    OpenCVR 有新成员 OpenCVV OpenCVC
  • 原文地址:https://www.cnblogs.com/shy1766IT/p/9018587.html
Copyright © 2020-2023  润新知