2023年12月7日发(作者:)

springboot解决ThebeanuserRepository,definedinnu。。。

1、springboot 启动时报错:

2019-02-20 14:59:58.226 INFO 10092 --- [ main] bootssmApplication : Starting SpringbootssmApplication on DESKTOP-CI9APH3 with PID 10092 (C:MyWorkworkspace_ideaspringbootssmtargetclasses started by pa

2019-02-20 14:59:58.230 INFO 10092 --- [ main] bootssmApplication : No active profile set, falling back to default profiles: default

2019-02-20 14:59:59.155 INFO 10092 --- [ main] .toryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.

2019-02-20 14:59:59.229 WARN 10092 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: finitionOve

2019-02-20 14:59:59.236 INFO 10092 --- [ main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

2019-02-20 14:59:59.238 ERROR 10092 --- [ main] gFailureAnalysisReporter :

***************************

APPLICATION FAILED TO START

***************************

Description:

The bean 'userRepository', defined in null, could not be registered. A bean with that name has already been defined in file [C:MyWorkworkspace_ideaspring] and

Action:

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

Process finished with exit code 1

2、解决办法:

在配置文件中添加:

-bean-definition-overriding=true