https://github.com/crossoverjie/ssm-request-check
:hourglass_flowing_sand: 基于annotation的http请求去重插件
https://github.com/crossoverjie/ssm-request-check
annotation java
Last synced: 9 months ago
JSON representation
:hourglass_flowing_sand: 基于annotation的http请求去重插件
- Host: GitHub
- URL: https://github.com/crossoverjie/ssm-request-check
- Owner: crossoverJie
- License: gpl-2.0
- Created: 2017-05-22T17:15:12.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-08-28T07:05:03.000Z (over 8 years ago)
- Last Synced: 2025-04-17T19:18:18.958Z (9 months ago)
- Topics: annotation, java
- Language: Java
- Homepage: https://crossoverjie.top/2017/05/24/SSM14/
- Size: 16.6 KB
- Stars: 10
- Watchers: 3
- Forks: 15
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/crossoverJie/SSM-REQUEST-CHECK)
# 开发
https://crossoverjie.top/2017/05/24/SSM14/
# 预览



# 简介
基于annotation的http去重插件:
- `Redis`保存请求。
- `Spring AOP` 进行切面。
**后续会用`Spring Boot`重构**
# 安装
```
https://github.com/crossoverJie/SSM-REQUEST-CHECK.git
```
```
cd SSM-REQUEST-CHECK
```
```
mvn clean
```
```
mvn install
```
# 使用
## 加入依赖
```xml
com.crossoverJie
SSM-REQUEST-CHECK
1.0.0
```
## 开启CGLIB代理
> 需要根据自己`web.xml`中定义的
```xml
SpringMVC
org.springframework.web.servlet.DispatcherServlet
contextConfigLocation
classpath:spring-mvc.xml
1
true
```
`spring-mvc.xml`文件中配置:
```xml
```
## 使用注解
```java
@CheckReqNo
@RequestMapping(value = "/createRedisContent",method = RequestMethod.POST)
@ResponseBody
public BaseResponse createRedisContent(@RequestBody RedisContentReq redisContentReq){
BaseResponse response = new BaseResponse() ;
Rediscontent rediscontent = new Rediscontent() ;
try {
CommonUtil.setLogValueModelToModel(redisContentReq,rediscontent);
rediscontentMapper.insertSelective(rediscontent) ;
response.setReqNo(redisContentReq.getReqNo());
response.setCode(StatusEnum.SUCCESS.getCode());
response.setMessage(StatusEnum.SUCCESS.getMessage());
}catch (Exception e){
logger.error("system error",e);
response.setReqNo(response.getReqNo());
response.setCode(StatusEnum.FAIL.getCode());
response.setMessage(StatusEnum.FAIL.getMessage());
}
return response ;
}
```
## 自定义缓存前缀、时间
> 默认缓存前缀是`reqNo`,时间为1天。
```
#redis前缀
redis.prefixReq=reqNo
#redis缓存时间 默认单位为天
redis.day=1
```
# 联系作者
- [crossoverJie@gmail.com](mailto:crossoverJie@gmail.com)
