zoukankan      html  css  js  c++  java
  • springboot

    1. http://springboot.javaboy.org/2019/0412/springboot-init
      maven 创建springboot2
      image

    创建完成后,在 pom.xml 文件中,添加如下依赖:

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.4.RELEASE</version>
    </parent>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>
    

    添加成功后,再在 java 目录下创建包,包中创建一个名为 App 的启动类,如下:

    @EnableAutoConfiguration
    @RestController
    public class App {
        public static void main(String[] args) {
            SpringApplication.run(App.class, args);
        }
        @GetMapping("/hello")
        public String hello() {
            return "hello";
        }
    }
    

    @EnableAutoConfiguration 注解表示开启自动化配置。

    然后执行这里的 main 方法就可以启动一个 Spring Boot 工程了。

  • 相关阅读:
    登录认证
    json
    关于优化
    网站资源
    设计模式
    Python
    查兰IP
    Linux命令
    centos7.0KVM虚拟化
    Shell数组
  • 原文地址:https://www.cnblogs.com/jigr/p/15492238.html
Copyright © 2011-2022 走看看