使用springboot实现轻量级的博客系统-技术

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无法直接进行建立,或者说不会.

Quartz

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值