IDEA 创建springboot

2021-04-20 21:27

阅读:603

标签:导入   not   mave   str   amp   tag   enable   engine   ide   

maven 

1

技术图片

 

 2

技术图片

 

 3导入依赖

pom.xml

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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    modelVersion>4.0.0modelVersion>
    parent>
        groupId>org.springframework.bootgroupId>
        artifactId>spring-boot-starter-parentartifactId>
        version>2.2.2.RELEASEversion>
        relativePath/> 
    parent>
    groupId>com.examplegroupId>
    artifactId>spring-bootartifactId>
    version>0.0.1-SNAPSHOTversion>
    name>spring-bootname>
    description>Demo project for Spring Bootdescription>

    dependencies>
        dependency>
            groupId>org.springframework.bootgroupId>
            artifactId>spring-boot-starter-webartifactId>
        dependency>

        dependency>
            groupId>org.springframework.bootgroupId>
            artifactId>spring-boot-starter-testartifactId>
            scope>testscope>
            exclusions>
                exclusion>
                    groupId>org.junit.vintagegroupId>
                    artifactId>junit-vintage-engineartifactId>
                exclusion>
            exclusions>
        dependency>
    dependencies>

    build>
        plugins>
            plugin>
                groupId>org.springframework.bootgroupId>
                artifactId>spring-boot-maven-pluginartifactId>
            plugin>
        plugins>
    build>

project>

 

4.代码

 

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;

@RestController
@EnableAutoConfiguration
public class Test {

    @RequestMapping("/")
    public String index() {
        return "Greetings from Spring Boot!";
    }

    public static void main(String[] args) {
        SpringApplication.run(Test.class,args);
    }
}

 

5运行

http://127.0.0.1:8080/

IDEA 创建springboot

标签:导入   not   mave   str   amp   tag   enable   engine   ide   

原文地址:https://www.cnblogs.com/buchizaodian/p/13284056.html


评论


亲,登录后才可以留言!