提交 | 用户 | 时间
|
e7c126
|
1 |
package com.iailab.framework.idempotent.config; |
H |
2 |
|
|
3 |
import com.iailab.framework.idempotent.core.aop.IdempotentAspect; |
|
4 |
import com.iailab.framework.idempotent.core.keyresolver.impl.DefaultIdempotentKeyResolver; |
|
5 |
import com.iailab.framework.idempotent.core.keyresolver.impl.ExpressionIdempotentKeyResolver; |
|
6 |
import com.iailab.framework.idempotent.core.keyresolver.IdempotentKeyResolver; |
|
7 |
import com.iailab.framework.idempotent.core.keyresolver.impl.UserIdempotentKeyResolver; |
|
8 |
import com.iailab.framework.idempotent.core.redis.IdempotentRedisDAO; |
|
9 |
import org.springframework.boot.autoconfigure.AutoConfiguration; |
|
10 |
import com.iailab.framework.redis.config.IailabRedisAutoConfiguration; |
|
11 |
import org.springframework.context.annotation.Bean; |
|
12 |
import org.springframework.data.redis.core.StringRedisTemplate; |
|
13 |
|
|
14 |
import java.util.List; |
|
15 |
|
|
16 |
@AutoConfiguration(after = IailabRedisAutoConfiguration.class) |
|
17 |
public class IailabIdempotentConfiguration { |
|
18 |
|
|
19 |
@Bean |
|
20 |
public IdempotentAspect idempotentAspect(List<IdempotentKeyResolver> keyResolvers, IdempotentRedisDAO idempotentRedisDAO) { |
|
21 |
return new IdempotentAspect(keyResolvers, idempotentRedisDAO); |
|
22 |
} |
|
23 |
|
|
24 |
@Bean |
|
25 |
public IdempotentRedisDAO idempotentRedisDAO(StringRedisTemplate stringRedisTemplate) { |
|
26 |
return new IdempotentRedisDAO(stringRedisTemplate); |
|
27 |
} |
|
28 |
|
|
29 |
// ========== 各种 IdempotentKeyResolver Bean ========== |
|
30 |
|
|
31 |
@Bean |
|
32 |
public DefaultIdempotentKeyResolver defaultIdempotentKeyResolver() { |
|
33 |
return new DefaultIdempotentKeyResolver(); |
|
34 |
} |
|
35 |
|
|
36 |
@Bean |
|
37 |
public UserIdempotentKeyResolver userIdempotentKeyResolver() { |
|
38 |
return new UserIdempotentKeyResolver(); |
|
39 |
} |
|
40 |
|
|
41 |
@Bean |
|
42 |
public ExpressionIdempotentKeyResolver expressionIdempotentKeyResolver() { |
|
43 |
return new ExpressionIdempotentKeyResolver(); |
|
44 |
} |
|
45 |
|
|
46 |
} |