SpringBoot 整合knife4j

91 阅读1分钟

1、引入依赖

<dependency>
    <groupId>com.github.xiaoymin</groupId>
    <artifactId>knife4j-spring-boot-starter</artifactId>
    <version>3.0.3</version>
</dependency>

2、Controller使用 相关注解 常用注解说明:blog.csdn.net/m0_61682705…

@RestController
@Api(tags = "Jasypt加密相关接口")
public class JasyptTestController {

    @RequestMapping("/encrypt")
    @ApiOperation(value = "加密",httpMethod = "GET")
    private String encrypt(String text, String password) {
        return Jasypt.encrypt(text, password);
    }

    @RequestMapping("/decrypt")
    @ApiOperation(value = "解密",httpMethod = "GET")
    private String decrypt(String text, String password) {
        return Jasypt.decrypt(text, password);
    }
}

3、http://localhost:5203/doc.html 访问 ip:端口/doc.html

image.png