wyt1215819315 / autoplan

这是一个自动化的托管系统,目前支持bilibili,米游社原神星铁等签到
https://auto.oldwu.top
Apache License 2.0
693 stars 176 forks source link

第一次接触java项目,有大佬解答一下这是什么问题吗? #42

Closed ghost closed 2 years ago

ghost commented 2 years ago

. _ _ /\ / '_ () \ \ \ \ ( ( )\ | ' | '| | ' \/ ` | \ \ \ \ \/ _)| |)| | | | | || (| | ) ) ) ) ' |__| .|| ||| |\, | / / / / =========|_|==============|__/=//// :: Spring Boot :: (v2.6.3)

2022-03-25 10:56:08.923 INFO 32734 --- [ main] com.AutoPlanApplication : Starting AutoPlanApplication v0.0.1-SNAPSHOT using Java 1.8.0-internal on root with PID 32734 (/www/wwwroot/dg.tingkai.tk/auto_plan-https.jar started by springboot in /www/wwwroot/dg.tingkai.tk) 2022-03-25 10:56:08.933 INFO 32734 --- [ main] com.AutoPlanApplication : No active profile set, falling back to default profiles: default 2022-03-25 10:56:11.968 WARN 32734 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.support.BeanDefinitionOverrideException: Invalid bean definition with name 'customUserService' defined in class path resource [com/oldwu/config/WebSecurityConfig.class]: Cannot register bean definition [Root bean: class [null]; scope=; abstract=false; lazyInit=null; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=webSecurityConfig; factoryMethodName=customUserService; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/oldwu/config/WebSecurityConfig.class]] for bean 'customUserService': There is already [Generic bean: class [com.oldwu.security.CustomUserService]; scope=singleton; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in URL [jar:file:/www/wwwroot/dg.tingkai.tk/auto_plan-https.jar!/BOOT-INF/classes!/com/oldwu/security/CustomUserService.class]] bound. 2022-03-25 10:56:12.013 INFO 32734 --- [ main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2022-03-25 10:56:12.055 ERROR 32734 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :


APPLICATION FAILED TO START


Description:

The bean 'customUserService', defined in class path resource [com/oldwu/config/WebSecurityConfig.class], could not be registered. A bean with that name has already been defined in URL [jar:file:/www/wwwroot/dg.tingkai.tk/auto_plan-https.jar!/BOOT-INF/classes!/com/oldwu/security/CustomUserService.class] and overriding is disabled.

Action:

Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true

zhichao12 commented 2 years ago

重复引入bean, 配置文件中的spring.main.allow-bean-definition-overriding=true 没生效, 在resources新建一个配置文件, 将application-example.yml内容全部复制过去, 就行

xiuxiudada commented 2 years ago

同样遇到这个问题,我直接把yml改写成properties