- 首先推荐一个好玩的网站 ASCll ,可以把你想要的字母生成文本的图形,然后 - copy到- banner.txt,即可替换- Spring Boot的开启图标
88 88 88 88 88 88 88 88 ,adPPYba, 8b d8 ,adPPYba, 88 88 88 88 a8" "8a `8b d8' a8P_____88 88 88 88 88 8b d8 `8b d8' 8PP""""""" 88 88 88 88 "8a, ,a8" `8b,d8' "8b, ,aa "8a, ,a88 88 88 `"YbbdP"' "8" `"Ybbd8"' `"YbbdP'Y8 88 88 88 88 "" "" 88 ,adPPYba, 88,dPPYba, 88 88,dPYba,,adPYba, 88 8b,dPPYba, ,adPPYb,d8 I8[ "" 88P' "8a 88 88P' "88" "8a 88 88P' `"8a a8" `Y88 `"Y8ba, 88 88 88 88 88 88 88 88 88 8b 88 aa ]8I 88 88 88 88 88 88 88 88 88 "8a, ,d88 `"YbbdP"' 88 88 88 88 88 88 88 88 88 `"YbbdP"Y8 aa, ,88 "Y8bbdP"
spring boot
Swagger2
Swagger是一款可以快速生成符合RESTful风格API并进行在线调试的插件。REST实际上为Representational State Transfer的缩写,翻译为“表现层状态转化” 。如果一个架构符合REST原则,就称它为RESTful架构。 实际上,“表现层状态转化”省略了主语,完整的说应该是“资源表现层状态转化”。什么是资源Resource?资源指的是网络中信息的表现形式,比如一段文本,一首歌,一个视频文件等等;什么是表现层Reresentational?表现层即资源的展现在你面前的形式,比如文本可以是JSON格式的,也可以是XML形式的,甚至为二进制形式的。图片可以是gif,也可以是PNG;什么是状态转换State Transfer?用户可使用URL通过HTTP协议来获取各种资源,HTTP协议包含了一些操作资源的方法,比如:GET 用来获取资源, POST 用来新建资源 , PUT用来更新资源,DELETE 用来删除资源,PATCH 用来更新资源的部分属性。通过这些HTTP协议的方法来操作资源的过程即为状态转换。
- 传统 - URL请求和- RESTful风格请求的区别
描述 传统请求 方法 RESTful请求 方法 查询 /user/query?name=mrbird GET /user?name=mrbird GET 详情 /user/getInfo?id=1 GET /user/1 GET 创建 /user/create?name=mrbird POST /user POST 修改 /user/update?name=mrbird&id=1 POST /user/1 PUT 删除 /user/delete?id=1 GET /user/1 DELETE
大致可以总结下传统请求和RESTful请求的几个区别:
- 传统请求通过URL来描述行为,如 - create,- delete等;- RESTful请求通过- URL来描述资源。
- RESTful请求通过- HTTP请求的方法来描述行为,比如- DELETE,- POST,- PUT等,并且使用- HTTP状态码来表示不同的结果。
- RESTful请求通过- JSON来交换数据。
一、引入Swagger、MySQL 依赖
 <!-- MySQL 连接驱动依赖 -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>${mysql-connector}</version>
        </dependency>
        <!-- Spring Boot Mybatis 依赖 -->
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>${mybatis-spring-boot}</version>
        </dependency>
        <!--使用的Swagger版本为2.6.1:-->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.6.1</version>
        </dependency>
        <!--ui的界面-->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.6.1</version>
        </dependency>二、配置 SwaggerConfig
/**
 * author: Created by shiming on 2018/9/26 18:10
 * mailbox:lamshiming@sina.com
 */@Configuration@EnableSwagger2public class SwaggerConfig {    // 在配置类中添加@EnableSwagger2注解来启用Swagger2,apis()定义了扫描的包路径
    @Bean
    public Docket buildDocket() {        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(buildApiInf())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.example.swagger.web"))
                .paths(PathSelectors.any())
                .build();
    }    private ApiInfo buildApiInf() {        return new ApiInfoBuilder()
                .title("RESTful API 文档")
                .contact(new Contact("shiming", "https://www.shiming.site/", null))
                .version("1.0")
                .build();
    }
}三、配置数据库,创建表
## 数据源配置spring.datasource.url= jdbc:mysql://localhost:3306/shiming?useUnicode=true&characterEncoding=utf-8&useSSL=truespring.datasource.username=root spring.datasource.password=App123 spring.datasource.driver-class-name=com.mysql.jdbc.Driver
- Navicat创建数据库一.png 
- 创建数据库 
DROP TABLE IF EXISTS `user`; CREATE TABLE `user` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', `user_name` varchar(25) DEFAULT NULL COMMENT '用户姓名', `user_age` varchar(25) DEFAULT NULL COMMENT '用户年级', `description` varchar(25) DEFAULT NULL COMMENT '用户描述', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
作者:豌豆射手_BiuBiu
链接:https://www.jianshu.com/p/13f649026b74