zoukankan      html  css  js  c++  java
  • SprintBoot 1.2.8 入门

    现在SpringBoot官网Quick Start的版本是1.5.3,试了一下,报错说我JDK版本太低,查了一下说是需要JDK8,所以我使用了旧版本1.2.8,实际上在POM中的依赖配置方式一样的。

    我贴出新旧版本的POM配置片段以作比较

    官网1.5.3 :

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.3.RELEASE</version>
    </parent>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>
    package hello;
    
    import org.springframework.boot.*;
    import org.springframework.boot.autoconfigure.*;
    import org.springframework.stereotype.*;
    import org.springframework.web.bind.annotation.*;
    
    @Controller
    @EnableAutoConfiguration
    public class SampleController {
    
        @RequestMapping("/")
        @ResponseBody
        String home() {
            return "Hello World!";
        }
    
        public static void main(String[] args) throws Exception {
            SpringApplication.run(SampleController.class, args);
        }
    }

    Mine 1.2.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/maven-v4_0_0.xsd">
    
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>1.2.8.RELEASE</version>
        </parent>
    
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.wx.onepass</groupId>
        <artifactId>onepass-parent</artifactId>
        <packaging>pom</packaging>
        <version>0.0.1-SNAPSHOT</version>
        <name>onepass-parent</name>
    
        <modules>
            <module>onepass-dependencies</module>
            <module>onepass-test</module>
            <module>onepass-batch</module>
            <module>onepass-web</module>
        </modules>
        
        <properties>
            <!-- 依赖包版本号 -->
            <junit.version>3.8.1</junit.version>
            <spring-boot-legacy.version>1.1.0.RELEASE</spring-boot-legacy.version>
        </properties>
        
        <dependencyManagement>
            <dependencies>
                <!-- junit -->
                <dependency>
                    <groupId>junit</groupId>
                    <artifactId>junit</artifactId>
                    <version>${junit.version}</version>
                    <scope>test</scope>
                </dependency>
                
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-legacy</artifactId>
                    <version>${spring-boot-legacy.version}</version>
                </dependency>
                
            </dependencies>
        </dependencyManagement>
        
        <build>
            <finalName>onepass</finalName>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.5</version>
                    <configuration>
                        <!-- 指定source和target的版本 -->
                        <source>1.7</source>
                        <target>1.7</target>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </project>
  • 相关阅读:
    httpclient在获取response的entity时报异常
    SpringCloud项目,接口调用返回http 500
    使用maven插件生成grpc所需要的Java代码
    win10 无法修改默认程序 默认打开方式的解决方法
    mock.js中新增测试接口无效,返回404
    echarts的pie图中,各区块颜色的调整
    HashMap源码注释翻译
    netty学习记录2
    netty学习记录1
    Java-JNA使用心得2
  • 原文地址:https://www.cnblogs.com/heben/p/6934175.html
Copyright © 2011-2022 走看看