liunancun opened a new issue #9814:
URL: https://github.com/apache/dubbo/issues/9814


   <!-- If you need to report a security issue please visit 
https://github.com/apache/dubbo/security/policy -->
   
   - [ ] I have searched the [issues](https://github.com/apache/dubbo/issues) 
of this repository and believe that this is not a duplicate.
   
   ### Environment
   
   * Dubbo version: 3.0.6
   * Operating System version: Window 7
   * Java version: jdk8
   
   ### Steps to reproduce this issue
   
   ```
   @Service
   public class DemoService {
   }
   ```
   
   ```
   @SpringBootApplication
   public class DemoApplication {
   
        public static void main(String[] args) {
                SpringApplication.run(DemoApplication.class, args);
        }
   
        @Bean
        public DemoService demoService() {
                return new DemoService();
        }
   
   }
   ```
   
   Pls. provide [GitHub address] to reproduce this issue.
   
   ### Expected Behavior
   
   Started successfully
   
   ### Actual Behavior
   
   Startup failed
   
   If there is an exception, please attach the exception trace:
   
   ```
   2022-03-20 17:13:21.794  INFO 6920 --- [           main] 
d.s.b.c.e.WelcomeLogoApplicationListener : 
   
    :: Dubbo Spring Boot (v3.0.6) : 
https://github.com/apache/dubbo-spring-boot-project
    :: Dubbo (v3.0.6) : https://github.com/apache/dubbo
    :: Discuss group : [email protected]
   
   
     .   ____          _            __ _ _
    /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
   ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
    \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
     '  |____| .__|_| |_|_| |_\__, | / / / /
    =========|_|==============|___/=/_/_/_/
    :: Spring Boot ::       (v2.2.10.RELEASE)
   
   2022-03-20 17:13:21.907  INFO 6920 --- [           main] 
com.example.demo.DemoApplication         : Starting DemoApplication on 
QWERTYUIOP-PC with PID 6920 
(D:\work\workspace\elasticsearch\demo\target\classes started by liunancun in 
D:\work\workspace\elasticsearch\demo)
   2022-03-20 17:13:21.908  INFO 6920 --- [           main] 
com.example.demo.DemoApplication         : No active profile set, falling back 
to default profiles: default
   2022-03-20 17:13:22.357  WARN 6920 --- [           main] 
ConfigServletWebServerApplicationContext : Exception encountered during context 
initialization - cancelling refresh attempt: 
org.springframework.beans.factory.support.BeanDefinitionOverrideException: 
Invalid bean definition with name 'demoService' defined in 
com.example.demo.DemoApplication: Cannot register bean definition [Root bean: 
class [null]; scope=; abstract=false; lazyInit=null; autowireMode=3; 
dependencyCheck=0; autowireCandidate=true; primary=false; 
factoryBeanName=demoApplication; factoryMethodName=demoService; 
initMethodName=null; destroyMethodName=(inferred); defined in 
com.example.demo.DemoApplication] for bean 'demoService': There is already 
[Generic bean: class [com.example.demo.DemoService]; scope=singleton; 
abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; 
autowireCandidate=true; primary=false; factoryBeanName=null; 
factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined
  in file 
[D:\work\workspace\elasticsearch\demo\target\classes\com\example\demo\DemoService.class]]
 bound.
   2022-03-20 17:13:22.370  INFO 6920 --- [           main] 
ConditionEvaluationReportLoggingListener : 
   
   Error starting ApplicationContext. To display the conditions report re-run 
your application with 'debug' enabled.
   2022-03-20 17:13:22.372 ERROR 6920 --- [           main] 
o.s.b.d.LoggingFailureAnalysisReporter   : 
   
   ***************************
   APPLICATION FAILED TO START
   ***************************
   
   Description:
   
   The bean 'demoService', defined in com.example.demo.DemoApplication, could 
not be registered. A bean with that name has already been defined in file 
[D:\work\workspace\elasticsearch\demo\target\classes\com\example\demo\DemoService.class]
 and overriding is disabled.
   
   Action:
   
   Consider renaming one of the beans or enabling overriding by setting 
spring.main.allow-bean-definition-overriding=true
   
   
   ```
   
   This is no problem in Dubbo2.7.3 version, I want to know why it will report 
an error in Dubbo3.0.6 version, what is the reason?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to