下载ruoyi框架,springboot+Vue 前后端分离版本,后台系统本地启动报错:
报错内容为:
|
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].; nested exception is java.lang.NoSuchMethodException: org.springframework.context.annotation.Configuration.proxyBeanMethods() at org.springframework.core.annotation.AnnotationUtils$AliasDescriptor.<init>(AnnotationUtils.java:2187) at org.springframework.core.annotation.AnnotationUtils$AliasDescriptor.from(AnnotationUtils.java:2155) at org.springframework.core.annotation.AnnotationUtils$AliasDescriptor.getOtherDescriptors(AnnotationUtils.java:2319) at org.springframework.core.annotation.AnnotationUtils$AliasDescriptor.getAttributeAliasNames(AnnotationUtils.java:2306) at org.springframework.core.annotation.AnnotationUtils.getAttributeAliasNames(AnnotationUtils.java:1820) at org.springframework.core.annotation.AnnotationUtils.getAttributeAliasMap(AnnotationUtils.java:1729) at org.springframework.core.annotation.AnnotationUtils.postProcessAnnotationAttributes(AnnotationUtils.java:1345) at org.springframework.core.annotation.AnnotatedElementUtils.getMergedAnnotationAttributes(AnnotatedElementUtils.java:365) at org.springframework.core.type.StandardAnnotationMetadata.getAnnotationAttributes(StandardAnnotationMetadata.java:121) at org.springframework.context.annotation.AnnotationConfigUtils.attributesFor(AnnotationConfigUtils.java:285) at org.springframework.context.annotation.AnnotationBeanNameGenerator.determineBeanNameFromAnnotation(AnnotationBeanNameGenerator.java:93) at org.springframework.context.annotation.AnnotationBeanNameGenerator.generateBeanName(AnnotationBeanNameGenerator.java:72) at org.springframework.context.annotation.AnnotatedBeanDefinitionReader.doRegisterBean(AnnotatedBeanDefinitionReader.java:225) at org.springframework.context.annotation.AnnotatedBeanDefinitionReader.registerBean(AnnotatedBeanDefinitionReader.java:146) at org.springframework.context.annotation.AnnotatedBeanDefinitionReader.register(AnnotatedBeanDefinitionReader.java:136) at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:156) at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:135) at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:127) at org.springframework.boot.SpringApplication.load(SpringApplication.java:688) at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:386) at org.springframework.boot.SpringApplication.run(SpringApplication.java:311) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1204) at com.ruoyi.RuoYiApplication.main(RuoYiApplication.java:18) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) Caused by: java.lang.NoSuchMethodException: org.springframework.context.annotation.Configuration.proxyBeanMethods() at java.lang.Class.getDeclaredMethod(Class.java:2130) at org.springframework.core.annotation.AnnotationUtils$AliasDescriptor.<init>(AnnotationUtils.java:2180) ... 28 common frames omitted
|
报错原因:
springboot很多依赖插件是有依赖时,就会读取相关配置,如果读取不到,就会使用默认的,可能会报错,但是又在项目中不好排除就可以使用 @EnableAutoConfiguration 注解。启动的时候就不会去读取这些配置了。
解决方案:
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class}) public class RuoYiApplication
|
在
@SpringBootApplication的exclude 注解中加入HibernateJpaAutoConfiguration.class
即:
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
项目启动成功。