SpringBoot使用IDEA创建项目
选择springboot,选择java版本,maven项目
然后
然后完成了就
现在就是这样了
删除多余的文件
现在直接启动
现在运行完就结束了
怎么能不结束呢,是不是需要导入web依赖啊
在启动
现在tomcat就被继承进来了
我们写一个controller
package com.kuang.springboot01helloworld.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
 * @author victor
 * @site https://victorfengming.github.io/
 * @company XDL
 * @project springboot-01-helloworld
 * @package com.kuang.springboot01helloworld.controller
 * @created 2020-07-24 14:17
 * @function ""
 */
/*
*
* Spring boot 热部署
* */
@Controller
@RequestMapping("/hello")
public class HelloController {
    @RequestMapping("/hello")
    @ResponseBody
    public String hello() {
        return "helloworld!!!哦哦哦";
    }
}
重新启动 在配置文件中更改项目的端口号
编辑application.properties文件:
spring.application.name=springboot-01-helloworld
management.endpoints.jmx.exposure.include=*
management.endpoints.web.exposure.include=*
management.endpoint.health.show-details=always
# spring cloud access&secret config
# 可以访问如下地址查看: https://usercenter.console.aliyun.com/#/manage/ak
alibaba.cloud.access-key=****
alibaba.cloud.secret-key=****
# 应用服务 WEB 访问端口
server.port=8180
# Actuator Web 访问端口
management.server.port=8081
我们可以自定义banner
springboot banner 在线生成
比如: www.bootschool.net/ascii-art
我们找一个图形,然后编辑banner.txt文件:
                              _.-="_-         _
                         _.-="   _-          | ||"""""""---._______     __..
             ___.===""""-.______-,,,,,,,,,,,,`-''----" """""       """""  __'
      __.--""     __        ,'   spring victor    o \           __        [__|
 __-""=======.--""  ""--.=================================.--""  ""--.=======:
]       [w] : /        \ : |========================|    : /        \ :  [w] :
V___________:|          |: |========================|    :|          |:   _-"
 V__________: \        / :_|=======================/_____: \        / :__-"
 -----------'  "-____-"  `-------------------------------'  "-____-"
重新启动运行
就成了









