55import com .codingapi .springboot .fast .executor .JpaExecutor ;
66import com .codingapi .springboot .fast .executor .MvcMethodInterceptor ;
77import com .codingapi .springboot .fast .mapping .MvcEndpointMapping ;
8- import lombok .AllArgsConstructor ;
98import lombok .SneakyThrows ;
109import lombok .extern .slf4j .Slf4j ;
1110import org .springframework .aop .Advisor ;
1211import org .springframework .aop .framework .AdvisedSupport ;
1312import org .springframework .aop .framework .AopProxy ;
13+ import org .springframework .aop .framework .AopProxyFactory ;
1414import org .springframework .aop .framework .DefaultAopProxyFactory ;
1515import org .springframework .data .domain .Pageable ;
1616import org .springframework .util .StringUtils ;
2121import java .util .Set ;
2222
2323@ Slf4j
24- @ AllArgsConstructor
2524public class MvcMappingRegistrar {
2625 protected final static Set <Class <?>> classSet = new HashSet <>();
2726 private final MvcEndpointMapping mvcEndpointMapping ;
28- private final JpaExecutor jpaExecutor ;
2927
30- private final DefaultAopProxyFactory proxyFactory = new DefaultAopProxyFactory () ;
28+ private final AopProxyFactory proxyFactory ;
3129
3230 private final List <Advisor > advisors ;
3331
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+
3443 @ SneakyThrows
3544 public void registerMvcMapping () {
3645 for (Class <?> clazz : classSet ) {
@@ -47,9 +56,8 @@ public void registerMvcMapping() {
4756 }
4857 }
4958
50- private AdvisedSupport createAdvisedSupport (Class <?> clazz ){
59+ private AdvisedSupport createAdvisedSupport (Class <?> clazz ) {
5160 AdvisedSupport advisedSupport = new AdvisedSupport (clazz );
52- MvcMethodInterceptor interceptor = new MvcMethodInterceptor (jpaExecutor );
5361 advisedSupport .setTarget (interceptor );
5462 advisedSupport .addAdvisors (advisors );
5563 advisedSupport .addAdvice (interceptor );
0 commit comments