You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "LanaGan (via GitHub)" <gi...@apache.org> on 2025/02/18 09:34:57 UTC

[I] @Bean method 'shardingSphereDataSource' must not be declared as autowired [shardingsphere]

LanaGan opened a new issue, #34704:
URL: https://github.com/apache/shardingsphere/issues/34704

   ## Question
   In springboot(3.4.1) I rely on the shardingsphere-jdbc-core-spring-boot-starter package。The following error occurred
     .   ____          _            __ _ _
    /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
   ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
    \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
     '  |____| .__|_| |_|_| |_\__, | / / / /
    =========|_|==============|___/=/_/_/_/
   
    :: Spring Boot ::                (v3.4.1)
   
   Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
   2025-02-18T17:14:19.496+08:00 ERROR 23288 --- [           main] o.s.boot.SpringApplication               : Application run failed
   
   org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: @Bean method 'shardingSphereDataSource' must not be declared as autowired; remove the method-level @Autowired annotation.
   Offending resource: class path resource [org/apache/shardingsphere/spring/boot/ShardingSphereAutoConfiguration.class]
   	at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:72) ~[spring-beans-6.2.1.jar:6.2.1]
   	at org.springframework.context.annotation.BeanMethod.validate(BeanMethod.java:52) ~[spring-context-6.2.1.jar:6.2.1]
   	at org.springframework.context.annotation.ConfigurationClass.validate(ConfigurationClass.java:232) ~[spring-context-6.2.1.jar:6.2.1]
   	at org.springframework.context.annotation.ConfigurationClassParser.validate(ConfigurationClassParser.java:214) ~[spring-context-6.2.1.jar:6.2.1]
   	at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:419) ~[spring-context-6.2.1.jar:6.2.1]
   	at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:290) ~[spring-context-6.2.1.jar:6.2.1]
   	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:349) ~[spring-context-6.2.1.jar:6.2.1]
   	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:118) ~[spring-context-6.2.1.jar:6.2.1]
   	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:791) ~[spring-context-6.2.1.jar:6.2.1]
   	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:609) ~[spring-context-6.2.1.jar:6.2.1]
   	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.4.1.jar:3.4.1]
   	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752) ~[spring-boot-3.4.1.jar:3.4.1]
   	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439) ~[spring-boot-3.4.1.jar:3.4.1]
   	at org.springframework.boot.SpringApplication.run(SpringApplication.java:318) ~[spring-boot-3.4.1.jar:3.4.1]
   	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1361) ~[spring-boot-3.4.1.jar:3.4.1]
   	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1350) ~[spring-boot-3.4.1.jar:3.4.1]
   	at com.ganlan.DemoApplication.main(DemoApplication.java:29) ~[classes/:na]
   
   Disconnected from the target VM, address: '127.0.0.1:62888', transport: 'socket'
   
   Process finished with exit code 1
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] @Bean method 'shardingSphereDataSource' must not be declared as autowired [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu commented on issue #34704:
URL: https://github.com/apache/shardingsphere/issues/34704#issuecomment-2676053772

   `shardingsphere-jdbc-core-spring-boot-starter` is deprecated and removed in 5.3.0, please try new version and use ShardingSphere Driver.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] @Bean method 'shardingSphereDataSource' must not be declared as autowired [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu closed issue #34704: @Bean method 'shardingSphereDataSource' must not be declared as autowired
URL: https://github.com/apache/shardingsphere/issues/34704


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] @Bean method 'shardingSphereDataSource' must not be declared as autowired [shardingsphere]

Posted by "gdutLiang (via GitHub)" <gi...@apache.org>.
gdutLiang commented on issue #34704:
URL: https://github.com/apache/shardingsphere/issues/34704#issuecomment-3003809465

   use shardingsphere-jdbc 
   https://shardingsphere.apache.org/document/current/cn/quick-start/shardingsphere-jdbc-quick-start/


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] @Bean method 'shardingSphereDataSource' must not be declared as autowired [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu commented on issue #34704:
URL: https://github.com/apache/shardingsphere/issues/34704#issuecomment-2666029162

   What is the version?


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] @Bean method 'shardingSphereDataSource' must not be declared as autowired [shardingsphere]

Posted by "wolf-hunter404 (via GitHub)" <gi...@apache.org>.
wolf-hunter404 commented on issue #34704:
URL: https://github.com/apache/shardingsphere/issues/34704#issuecomment-2670552204

   > What is the version?
   
   I also encountered this error.
   Spring boot version: 3.4.1
   shardingsphere-jdbc-core-spring-boot-starter: 5.2.1
   
   gradle dependencie:
   implementation 'org.apache.shardingsphere:shardingsphere-jdbc-core-spring-boot-starter:5.2.1'


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] @Bean method 'shardingSphereDataSource' must not be declared as autowired [shardingsphere]

Posted by "wolf-hunter404 (via GitHub)" <gi...@apache.org>.
wolf-hunter404 commented on issue #34704:
URL: https://github.com/apache/shardingsphere/issues/34704#issuecomment-2676663819

   > `shardingsphere-jdbc-core-spring-boot-starter` is deprecated and removed in 5.3.0, please try new version and use ShardingSphere Driver.
   
   thanks!
   the spring-boot-starter, is there a latest version released? I didn't find it in the maven repository.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] @Bean method 'shardingSphereDataSource' must not be declared as autowired [shardingsphere]

Posted by "wolf-hunter404 (via GitHub)" <gi...@apache.org>.
wolf-hunter404 commented on issue #34704:
URL: https://github.com/apache/shardingsphere/issues/34704#issuecomment-2677295333

   > `shardingsphere-jdbc-core-spring-boot-starter` is deprecated and removed in 5.3.0, please try new version and use ShardingSphere Driver.
   
   The latest version on the maven repository is the 2023 version 5.4.1, and the latest version 5.5.x is not available?


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org