5
5
import com .codingapi .springboot .fast .executor .JpaExecutor ;
6
6
import com .codingapi .springboot .fast .executor .MvcMethodInterceptor ;
7
7
import com .codingapi .springboot .fast .mapping .MvcEndpointMapping ;
8
- import lombok .AllArgsConstructor ;
9
8
import lombok .SneakyThrows ;
10
9
import lombok .extern .slf4j .Slf4j ;
11
10
import org .springframework .aop .Advisor ;
12
11
import org .springframework .aop .framework .AdvisedSupport ;
13
12
import org .springframework .aop .framework .AopProxy ;
13
+ import org .springframework .aop .framework .AopProxyFactory ;
14
14
import org .springframework .aop .framework .DefaultAopProxyFactory ;
15
15
import org .springframework .data .domain .Pageable ;
16
16
import org .springframework .util .StringUtils ;
21
21
import java .util .Set ;
22
22
23
23
@ Slf4j
24
- @ AllArgsConstructor
25
24
public class MvcMappingRegistrar {
26
25
protected final static Set <Class <?>> classSet = new HashSet <>();
27
26
private final MvcEndpointMapping mvcEndpointMapping ;
28
- private final JpaExecutor jpaExecutor ;
29
27
30
- private final DefaultAopProxyFactory proxyFactory = new DefaultAopProxyFactory () ;
28
+ private final AopProxyFactory proxyFactory ;
31
29
32
30
private final List <Advisor > advisors ;
33
31
32
+ private final MvcMethodInterceptor interceptor ;
33
+
34
+ public MvcMappingRegistrar (MvcEndpointMapping mvcEndpointMapping ,
35
+ JpaExecutor jpaExecutor ,
36
+ List <Advisor > advisors ) {
37
+ this .mvcEndpointMapping = mvcEndpointMapping ;
38
+ this .advisors = advisors ;
39
+ this .interceptor = new MvcMethodInterceptor (jpaExecutor );
40
+ this .proxyFactory = new DefaultAopProxyFactory ();
41
+ }
42
+
34
43
@ SneakyThrows
35
44
public void registerMvcMapping () {
36
45
for (Class <?> clazz : classSet ) {
@@ -47,9 +56,8 @@ public void registerMvcMapping() {
47
56
}
48
57
}
49
58
50
- private AdvisedSupport createAdvisedSupport (Class <?> clazz ){
59
+ private AdvisedSupport createAdvisedSupport (Class <?> clazz ) {
51
60
AdvisedSupport advisedSupport = new AdvisedSupport (clazz );
52
- MvcMethodInterceptor interceptor = new MvcMethodInterceptor (jpaExecutor );
53
61
advisedSupport .setTarget (interceptor );
54
62
advisedSupport .addAdvisors (advisors );
55
63
advisedSupport .addAdvice (interceptor );
0 commit comments