swagger2的使用
1.引入依赖
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
2.写配置文件
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket createRestApi(){
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
// .apis(RequestHandlerSelectors.basePackage("com.example.Controller"))//指定包
.paths(PathSelectors.any())
.build();
}
@Bean
public ApiInfo apiInfo(){
return new ApiInfoBuilder()
.title("轻量博客系统后台接口")
.description("使用springboot创建的博客系统的后台接口")
.termsOfServiceUrl("http://blog.dispace.com/")
.build();
}
}
注意加上注解,理解注解含义。
注意是否要指定包,以及制定包的路径怎么写
service的url如何配置,貌似没多大关系
如果制定的包出错会报 No Operations in this spec"
3.swagger注解的使用
前后端交互
1.controller层
2.Response
3.前台获取数据的模板
4.model和modelAndView方法
建立ViewObject类进行数据的返回
通过model的addAttribute(“key”,“value”)方法进行数据的返回
Redis的使用
1.Redis的下载与服务器运行
2.Jedis的使用
3.RedisKeyUtil的使用
Initializingbean与拦截器
插件使用
1.flexmark
使用教程
数据库保存文章
外键表的约束完整性
使用text类型进行文章的存储
会产生的问题:占用太多的空间,外键使用Repository无法直接进行建立,或者说不会.