yidao620c / SpringBootBucket

Springboot bucket
MIT License
1.05k stars 709 forks source link

运行shiro工程出现错误nested exception is org.springframework.context.annotation.ConflictingBeanDefinitionException #12

Open dengkuanchina opened 5 years ago

dengkuanchina commented 5 years ago

你好,我在运行shiro工程时,用的idea,无法运行。已经尝试了使用maven中的tomcat插件,并且修改了配置中的文件路径。都不可以。出现的错误是: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.xncoding.pos.Application]; nested exception is org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'asyncTask' for bean class [com.xncoding.pos.async.AsyncTask] conflicts with existing, non-compatible bean definition of same name and class [com.xncoding.pos.server.AsyncTask] at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:184) at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:316) at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:233) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:271) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:91) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:694) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:762) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:398) at org.springframework.boot.SpringApplication.run(SpringApplication.java:330) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1258) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246) at com.xncoding.pos.Application.main(Application.java:9)

dengkuanchina commented 5 years ago

[ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.xncoding.pos.Application]; nested exception is org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'druidProperties' for bean class [com.xncoding.pos.config.DruidProperties] conflicts with existing, non-compatible bean definition of same name and class [com.xncoding.pos.config.properties.DruidProperties] 但是我找了1下,没有发现druidProperties有重复的情况。所以麻烦看看是否能运行。我用的是idea2018