1、SpringBoot使用@Pointcut(“@target(xxxxx)”)报错
org.springframework.beans.factory.BeanCreationException: Error creating bean wi
th name 'meterRegistryPostProcessor' defined in class path resource [org/springf
ramework/boot/actuate/autoconfigure/metrics/MetricsAutoConfiguration.class]: Ini
tialization of bean failed; nested exception is org.springframework.aop.framewor
k.AopConfigException: Could not generate CGLIB subclass of class org.springframe
work.boot.actuate.autoconfigure.metrics.MeterRegistryPostProcessor: Common cause
s of this problem include using a final class or a non-visible class; nested exc
eption is org.springframework.cglib.core.CodeGenerationException: java.lang.Ille
galAccessError-->class org.springframework.boot.actuate.autoconfigure.metrics.Me
terRegistryPostProcessor$$EnhancerBySpringCGLIB$$3a6cf68c cannot access its supe
rclass org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryPostP
rocessor
java.lang.IllegalAccessError: class org.springframework.boot.actuate.autoconfigu
re.metrics.MeterRegistryPostProcessor$$EnhancerBySpringCGLIB$$3a6cf68c cannot ac
cess its superclass org.springframework.boot.actuate.autoconfigure.metrics.Meter
RegistryPostProcessor
2、建议修改成
@Pointcut(“@within(xxxxx)”) 代理类
@Pointcut(“@annotation(xxxxx)”) 代理方法
3、原因
@target匹配的是运行时的类型,会给所有bean生成代理类,生成失败就会报错