zoukankan      html  css  js  c++  java
  • eclipse快速创建一个Spring Boot应用

    1,创建一个空的maven项目

    2,添加parent

        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.0.2.RELEASE</version>
        </parent>
        

    3,添加依赖

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

    4,添加编译插件

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

    5,添加启动类

    package com.googosoft.hystrix;
    
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    
    @SpringBootApplication
    public class HystrixApplication
    {
        public static void main( String[] args )
        {
            SpringApplication.run(HystrixApplication.class, args);
        }
    }

    6,添加测试Controller

    package com.googosoft.hystrix;
    
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.RestController;
    
    /** 
    * @author songyan 
    * @version 2020年2月11日 上午10:37:44 
    * @desc
    */
    @RestController
    public class TestController {
    
        @RequestMapping("test")
        public Object test(){
            return 22;
        }
    }

    7,重新制定jdk版本

    8,完整pom

    <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>
    
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.0.2.RELEASE</version>
        </parent>
    
        <groupId>com.googosoft</groupId>
        <artifactId>hystrix</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <packaging>jar</packaging>
    
        <name>hystrix</name>
        <url>http://maven.apache.org</url>
    
        <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        </properties>
    
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>3.8.1</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
            </plugins>
        </build>
    </project>
  • 相关阅读:
    电话号码和手机号码正则
    IntelliJ Idea 常用快捷键
    springboot常用注解
    idea常用快捷键和插件
    百度地图API的使用方法
    js 经常用到的键盘码
    https://www.cnblogs.com/
    axios传参 后台接收为空
    面相对象之继承
    初始面向对象
  • 原文地址:https://www.cnblogs.com/excellencesy/p/12294055.html
Copyright © 2011-2022 走看看