SpringBoot项目启动报错

Posted coder/ken

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SpringBoot项目启动报错相关的知识,希望对你有一定的参考价值。

org.springframework.core.annotation.AnnotationConfigurationException: Attribute \'proxyBeanMethods\' in annotation [org.springframework.boot.autoconfigure.SpringBootApplication] is declared as an @AliasFor nonexistent attribute \'proxyBeanMethods\' in annotation [org.springframework.context.annotation.Configuration].
    at org.springframework.core.annotation.AnnotationTypeMapping.resolveAliasTarget(AnnotationTypeMapping.java:163) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMapping.resolveAliasTarget(AnnotationTypeMapping.java:134) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMapping.resolveAliasedForTargets(AnnotationTypeMapping.java:126) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMapping.<init>(AnnotationTypeMapping.java:103) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMappings.addIfPossible(AnnotationTypeMappings.java:109) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMappings.addAllMappings(AnnotationTypeMappings.java:68) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMappings.<init>(AnnotationTypeMappings.java:61) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMappings.<init>(AnnotationTypeMappings.java:46) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMappings$Cache.createMappings(AnnotationTypeMappings.java:217) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at java.base/java.util.concurrent.ConcurrentMap.computeIfAbsent(ConcurrentMap.java:330) ~[na:na]
    at org.springframework.core.annotation.AnnotationTypeMappings$Cache.get(AnnotationTypeMappings.java:213) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMappings.forAnnotationType(AnnotationTypeMappings.java:181) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMappings.forAnnotationType(AnnotationTypeMappings.java:168) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.TypeMappedAnnotations$IsPresent.doWithAnnotations(TypeMappedAnnotations.java:330) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.TypeMappedAnnotations$IsPresent.doWithAnnotations(TypeMappedAnnotations.java:279) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationsScanner.processClassHierarchy(AnnotationsScanner.java:211) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationsScanner.processClassHierarchy(AnnotationsScanner.java:194) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationsScanner.processClass(AnnotationsScanner.java:128) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationsScanner.process(AnnotationsScanner.java:107) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationsScanner.scan(AnnotationsScanner.java:97) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationsScanner.scan(AnnotationsScanner.java:78) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.TypeMappedAnnotations.scan(TypeMappedAnnotations.java:242) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.TypeMappedAnnotations.isPresent(TypeMappedAnnotations.java:98) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]

报错日志如上。

看日志是@SpringBootApplication注解里的一个属性proxyBeanMethods在@Configuration未找到。我到代码里查了一下,发现确实在目前依赖的Configuration.CLASS方法里未找到该方法。

因此猜测是现在使用的对应jar包有问题。

这次排查问题,我突然想到是否可以去github上查一下是否有人也遇到过。因为springboot在github上是开源的。地址https://github.com/spring-projects/spring-boot

结果我真的在该仓库的issue里查到了历史消息。

 

 看历史消息,其中有个印度小哥似乎意识到是jar包问题,但是升级jar包没有效果。结果被提醒该类在spring-context里。主要是看这个jar。

然后我就专门看了下自己的现在依赖的该包。把它升级到了5.2.3就解决了这个报错。

以上是关于SpringBoot项目启动报错的主要内容,如果未能解决你的问题,请参考以下文章

springboot启动报错:Failed to configure a DataSource

翻车现场:解决SpringBoot项目启动访问后台JSP页面显示404报错

翻车现场:解决SpringBoot项目启动访问后台JSP页面显示404报错

翻车现场:解决SpringBoot项目启动访问后台JSP页面显示404报错

SpringBoot项目启动报错

SpringBoot项目启动报错