0

我正在升级我们的 Spring-Boot 应用程序 (2.5.6) 以使用 Java 17,我们将amazoncorretto:11-al2-jdk使用amazoncorretto:17-al2-jdkOpenJDK 17 的发行版。

在将我们的 Docker 基础映像添加到 Docker 映像中amazoncorretto:17-al2-jdk并将其全部打包后,应用程序无法启动,原因是:

Could not generate CGLIB subclass of class org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController: 
Common causes of this problem include using a final class or a non-visible class; nested exception is org.springframework.cglib.core.CodeGenerationException:
java.lang.LinkageError-->loader org.springframework.boot.loader.LaunchedURLClassLoader @17a7cec2
attempted duplicate class definition for org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController$$EnhancerBySpringCGLIB$$aee9141f.

根据错误消息,似乎 Spring 尝试生成一个子类,BasicErrorController但由于attempted duplicate class definition. (BasicErrorController 来自 Spring-Boot 库)。我已经尝试阅读 CGLIB 逻辑,但我无法弄清楚什么是错误/重复的类(并且我找不到任何最终类,正如错误消息建议所暗示的那样)。

有什么想法可以解决这个问题吗?

当我使用与 docker 映像中相同的 jdk17 直接从 IntelliJ IDE 运行应用程序时,它工作正常。


编辑:启用堆栈跟踪和调试级别的更多日志

       DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration' 
DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$DefaultErrorViewResolverConfiguration' 
DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Autowiring by type from bean name 'org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$DefaultErrorViewResolverConfiguration' via constructor to bean named 'org.springframework.web.context.support.AnnotationConfigWebApplicationContext@5b40de43' 
DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Autowiring by type from bean name 'org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$DefaultErrorViewResolverConfiguration' via constructor to bean named 'spring.resources-org.springframework.boot.autoconfigure.web.ResourceProperties' 
DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Autowiring by type from bean name 'org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$DefaultErrorViewResolverConfiguration' via constructor to bean named 'spring.web-org.springframework.boot.autoconfigure.web.WebProperties' 
DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'errorAttributes' 
DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'basicErrorController' 
DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Autowiring by type from bean name 'basicErrorController' via factory method to bean named 'errorAttributes' 
WARN  org.springframework.web.context.support.AnnotationConfigWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'basicErrorController' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/error/ErrorMvcAutoConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController: Common causes of this problem include using a final class or a non-visible class; nested exception is org.springframework.cglib.core.CodeGenerationException: java.lang.LinkageError-->loader org.springframework.boot.loader.LaunchedURLClassLoader @17a7cec2 attempted duplicate class definition for org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController$$EnhancerBySpringCGLIB$$3b1a7b57. (org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController$$EnhancerBySpringCGLIB$$3b1a7b57 is in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @17a7cec2, parent loader 'app') 
ERROR org.springframework.web.servlet.DispatcherServlet - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'basicErrorController' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/error/ErrorMvcAutoConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController: Common causes of this problem include using a final class or a non-visible class; nested exception is org.springframework.cglib.core.CodeGenerationException: java.lang.LinkageError-->loader org.springframework.boot.loader.LaunchedURLClassLoader @17a7cec2 attempted duplicate class definition for org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController$$EnhancerBySpringCGLIB$$3b1a7b57. (org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController$$EnhancerBySpringCGLIB$$3b1a7b57 is in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @17a7cec2, parent loader 'app')
    ... suppressed 17 lines
    at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[?:?]
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) ~[?:?]
    at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762) ~[?:?]
    at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276) ~[?:?]
    at java.util.TreeMap$ValueSpliterator.forEachRemaining(TreeMap.java:3215) ~[?:?]
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?]
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[?:?]
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[?:?]
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) ~[?:?]
    ... suppressed 9 lines
    at java.lang.Iterable.forEach(Iterable.java:75) [?:?]
    ... suppressed 8 lines
    at xxx.xxx.Application.main(Application.java:62) [classes!/:?]
    ... suppressed 8 lines
 Caused by: org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController: Common causes of this problem include using a final class or a non-visible class; nested exception is org.springframework.cglib.core.CodeGenerationException: java.lang.LinkageError-->loader org.springframework.boot.loader.LaunchedURLClassLoader @17a7cec2 attempted duplicate class definition for org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController$$EnhancerBySpringCGLIB$$3b1a7b57. (org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController$$EnhancerBySpringCGLIB$$3b1a7b57 is in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @17a7cec2, parent loader 'app')
    ... suppressed 8 lines
    ... 54 more
 Caused by: org.springframework.cglib.core.CodeGenerationException: java.lang.LinkageError-->loader org.springframework.boot.loader.LaunchedURLClassLoader @17a7cec2 attempted duplicate class definition for org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController$$EnhancerBySpringCGLIB$$3b1a7b57. (org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController$$EnhancerBySpringCGLIB$$3b1a7b57 is in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @17a7cec2, parent loader 'app')
    ... suppressed 22 lines
    ... 54 more
 Caused by: java.lang.LinkageError: loader org.springframework.boot.loader.LaunchedURLClassLoader @17a7cec2 attempted duplicate class definition for org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController$$EnhancerBySpringCGLIB$$3b1a7b57. (org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController$$EnhancerBySpringCGLIB$$3b1a7b57 is in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @17a7cec2, parent loader 'app')
    at java.lang.ClassLoader.defineClass0(Native Method) ~[?:?]
    at java.lang.System$2.defineClass(System.java:2307) ~[?:?]
    at java.lang.invoke.MethodHandles$Lookup$ClassDefiner.defineClass(MethodHandles.java:2439) ~[?:?]
    at java.lang.invoke.MethodHandles$Lookup$ClassDefiner.defineClass(MethodHandles.java:2416) ~[?:?]
    at java.lang.invoke.MethodHandles$Lookup.defineClass(MethodHandles.java:1843) ~[?:?]
    ... suppressed 25 lines
    ... 54 more
  
 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'basicErrorController' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/error/ErrorMvcAutoConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController: Common causes of this problem include using a final class or a non-visible class; nested exception is org.springframework.cglib.core.CodeGenerationException: java.lang.LinkageError-->loader org.springframework.boot.loader.LaunchedURLClassLoader @17a7cec2 attempted duplicate class definition for org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController$$EnhancerBySpringCGLIB$$3b1a7b57. (org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController$$EnhancerBySpringCGLIB$$3b1a7b57 is in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @17a7cec2, parent loader 'app')
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:628)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
    at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:702)
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:578)
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:530)
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:170)
    at javax.servlet.GenericServlet.init(GenericServlet.java:203)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1164)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1013)
    at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedContext.load(TomcatEmbeddedContext.java:82)
    at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
    at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
    at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
    at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276)
    at java.base/java.util.TreeMap$ValueSpliterator.forEachRemaining(TreeMap.java:3215)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
    at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
    at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedContext.lambda$deferredLoadOnStartup$0(TomcatEmbeddedContext.java:65)
    at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedContext.doWithThreadContextClassLoader(TomcatEmbeddedContext.java:106)
    at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedContext.deferredLoadOnStartup(TomcatEmbeddedContext.java:64)
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.performDeferredLoadOnStartup(TomcatWebServer.java:305)
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:216)
    at org.springframework.boot.web.servlet.context.WebServerStartStopLifecycle.start(WebServerStartStopLifecycle.java:43)
    at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178)
    at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54)
    at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356)
    at java.base/java.lang.Iterable.forEach(Iterable.java:75)
    at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155)
    at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123)
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:338)
    at xxx.xxx.application.Application.main(Application.java:62)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
 Caused by: org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController: Common causes of this problem include using a final class or a non-visible class; nested exception is org.springframework.cglib.core.CodeGenerationException: java.lang.LinkageError-->loader org.springframework.boot.loader.LaunchedURLClassLoader @17a7cec2 attempted duplicate class definition for org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController$$EnhancerBySpringCGLIB$$3b1a7b57. (org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController$$EnhancerBySpringCGLIB$$3b1a7b57 is in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @17a7cec2, parent loader 'app')
    at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:209)
    at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:110)
    at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.createProxy(AbstractAutoProxyCreator.java:478)
    at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:342)
    at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:291)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:455)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1808)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)
    ... 54 more
 Caused by: org.springframework.cglib.core.CodeGenerationException: java.lang.LinkageError-->loader org.springframework.boot.loader.LaunchedURLClassLoader @17a7cec2 attempted duplicate class definition for org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController$$EnhancerBySpringCGLIB$$3b1a7b57. (org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController$$EnhancerBySpringCGLIB$$3b1a7b57 is in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @17a7cec2, parent loader 'app')
    at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:580)
    at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:363)
    at org.springframework.cglib.proxy.Enhancer.generate(Enhancer.java:585)
    at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:110)
    at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:108)
    at org.springframework.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61)
    at org.springframework.cglib.core.internal.LoadingCache.get(LoadingCache.java:34)
    at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:134)
    at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:319)
    at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:572)
    at org.springframework.cglib.proxy.Enhancer.createClass(Enhancer.java:419)
    at org.springframework.aop.framework.ObjenesisCglibAopProxy.createProxyClassAndInstance(ObjenesisCglibAopProxy.java:57)
    at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:206)
    ... 61 more
 Caused by: java.lang.LinkageError: loader org.springframework.boot.loader.LaunchedURLClassLoader @17a7cec2 attempted duplicate class definition for org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController$$EnhancerBySpringCGLIB$$3b1a7b57. (org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController$$EnhancerBySpringCGLIB$$3b1a7b57 is in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @17a7cec2, parent loader 'app')
    at java.base/java.lang.ClassLoader.defineClass0(Native Method)
    at java.base/java.lang.System$2.defineClass(System.java:2307)
    at java.base/java.lang.invoke.MethodHandles$Lookup$ClassDefiner.defineClass(MethodHandles.java:2439)
    at java.base/java.lang.invoke.MethodHandles$Lookup$ClassDefiner.defineClass(MethodHandles.java:2416)
    at java.base/java.lang.invoke.MethodHandles$Lookup.defineClass(MethodHandles.java:1843)
    at java.base/jdk.internal.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:577)
    ... 75 more
 
...
 
WARN  org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server 
DEBUG org.springframework.data.redis.listener.RedisMessageListenerContainer - Stopped RedisMessageListenerContainer 
INFO  org.springframework.scheduling.quartz.SchedulerFactoryBean - Shutting down Quartz Scheduler 
DEBUG org.springframework.scheduling.quartz.LocalDataSourceJobStore - JobStore background threads shutdown. 
DEBUG org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler - Shutting down ExecutorService 'taskScheduler' 
DEBUG org.springframework.security.web.FilterChainProxy - Securing GET /ping 
DEBUG org.springframework.security.web.context.SecurityContextPersistenceFilter - Set SecurityContextHolder to empty SecurityContext 
DEBUG org.springframework.security.web.FilterChainProxy - Secured GET /ping 
DEBUG org.springframework.security.web.context.SecurityContextPersistenceFilter - Cleared SecurityContextHolder to complete request 
INFO  org.springframework.web.servlet.DispatcherServlet - Initializing Servlet 'web' 

更新:我设法确定了导致问​​题的文件。如果我删除该文件,它可以在 JDK17 上正常工作。

稍微研究一下方面逻辑后,可以看到这段代码在所有控制器上添加了建议。向我的应用程序添加包切入点限制后,它可以正常启动@Pointcut("within(one.goranson..*)")

@Aspect
@Component
@RequiredArgsConstructor
class ProcessingTimeAspect {

  @Pointcut("@annotation(requestMapping)")
  void requestMappingMethod(RequestMapping requestMapping) {
    // pointcuts are empty
  }

  @Pointcut("@target(restController)")
  void restController(RestController restController) {
    // pointcuts are empty
  }

  @SuppressWarnings("null")
  @Nullable
  @Around("requestMappingMethod(requestMapping) && restController(restController)")
  Object around(ProceedingJoinPoint joinPoint, RequestMapping requestMapping,
      RestController restController) throws Throwable {
    // Some unrelated code removed for measure request processing
    return joinPoint.proceed();
  }

}
4

0 回答 0