我得到:
在类路径资源[org / springframework / data / web / config / ProjectingArgumentResolverRegistrar.class]中定义名称为'projectingArgumentResolverBeanPostProcessor'的bean时出错。嵌套异常是java.lang.IllegalArgumentException:错误@annotation切入点表达式仅在Java 5合规性级别或更高级别上受支持 在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:581)〜[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] 尝试在基本的春季启动应用中添加per4j时出错
所以我一直在尝试将perf4j日志添加到我的spring boot应用程序中。 在这里,我已经在maven中设置了Java 8。
<properties>
<java.version>1.8</java.version>
</properties>
在我的本地环境中,我也只安装了Java 8。在为perf4j添加更改后运行应用程序时,它将引发以上错误。当我深入研究错误时,我可以看到:
原因:java.lang.IllegalArgumentException:错误@annotation切入点表达式仅在Java 5兼容级别或更高级别上受支持
类似的问题已经存在Error creating bean with name 'projectingArgumentResolverBeanPostProcessor' 但没有解决办法。
这是详细的错误:
org.springframework.beans.factory.BeanCreationException:在类路径资源[org / springframework / data / web / config / ProjectingArgumentResolverRegistrar.class]中创建名称为'projectingArgumentResolverBeanPostProcessor'的bean时出错。嵌套异常为java.lang.IllegalArgumentException:错误@annotation切入点表达式仅在Java 5兼容级别或更高级别上受支持
在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:581)〜[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495)〜[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
在org.springframework.beans.factory.support.AbstractBeanFactory.lambda $ doGetBean $ 0(AbstractBeanFactory.java:317)〜[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)〜[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
在org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)〜[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
在org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204)〜[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
在org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:236)〜[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE]
在org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:710)〜[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE]
在org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:535)〜[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE]
在org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)〜[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
在org.springframework.boot.SpringApplication.refresh(SpringApplication.java:780)上[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
在org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412)上[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
在org.springframework.boot.SpringApplication.run(SpringApplication.java:333)上[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
在org.springframework.boot.SpringApplication.run(SpringApplication.java:1277)[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
在org.springframework.boot.SpringApplication.run(SpringApplication.java:1265)上[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
在com.calamp.connect.ae.Application.main(Application.java:29)[classes /:na] 由以下原因引起:java.lang.IllegalArgumentException:错误@annotation切入点表达式仅在Java 5兼容级别或更高级别上受支持
在org.aspectj.weaver.tools.PointcutParser.parsePointcutExpression(PointcutParser.java:317)〜[aspectjtools-1.6.2.jar:na]
在org.springframework.aop.aspectj.AspectJExpressionPointcut.buildPointcutExpression(AspectJExpressionPointcut.java:227)〜[spring-aop-5.0.9.RELEASE.jar:5.0.9.RELEASE]
在org.springframework.aop.aspectj.AspectJExpressionPointcut.obtainPointcutExpression(AspectJExpressionPointcut.java:198)〜[spring-aop-5.0.9.RELEASE.jar:5.0.9.RELEASE]
在org.springframework.aop.aspectj.AspectJExpressionPointcut.getClassFilter(AspectJExpressionPointcut.java:177)〜[spring-aop-5.0.9.RELEASE.jar:5.0.9.RELEASE] 在org.springframework.aop.support.AopUtils.canApply(AopUtils.java:225)〜[spring-aop-5.0.9.RELEASE.jar:5.0.9.RELEASE]
在org.springframework.aop.support.AopUtils.canApply(AopUtils.java:288)〜[spring-aop-5.0.9.RELEASE.jar:5.0.9.RELEASE]
在org.springframework.aop.support.AopUtils.findAdvisorsThatCanApply(AopUtils.java:320)〜[spring-aop-5.0.9.RELEASE.jar:5.0.9.RELEASE]
在org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findAdvisorsThatCanApply(AbstractAdvisorAutoProxyCreator.java:126)〜[spring-aop-5.0.9.RELEASE.jar:5.0.9.RELEASE]
在org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:95)〜[spring-aop-5.0.9.RELEASE.jar:5.0.9.RELEASE]
在org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:76)〜[spring-aop-5.0.9.RELEASE.jar:5.0.9.RELEASE]
在org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:352)〜[spring-aop-5.0.9.RELEASE.jar:5.0.9.RELEASE]
在org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:304)〜[spring-aop-5.0.9.RELEASE.jar:5.0.9.RELEASE]
在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsInitialization之后(AbstractAutowireCapableBeanFactory.java:431)〜[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1703)〜[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:573)〜[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
...省略了15个常见框架
我添加了以下依赖项,以便在pom.xml中添加perf4j日志记录,如果这可以给任何人提供任何线索:
<dependency>
<groupId>org.perf4j</groupId>
<artifactId>perf4j</artifactId>
<version>0.9.16</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.aspectj/aspectjtools -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>commons-jexl</groupId>
<artifactId>commons-jexl</artifactId>
<version>1.1</version>
</dependency>
错误不应该出现,并且应用程序应该运行。
答案 0 :(得分:0)
https://coderwall.com/p/8tbjdg/aspectj-complaining-about-java-5-compliance-level
The above link is a gem.
It was a version issue, I upgraded the version of aspect to
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>1.9.2</version>
</dependency>
And it worked.