You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/02/11 02:11:42 UTC

[GitHub] [incubator-shardingsphere] yl1935 opened a new issue #4230: Has error when use orchestration and mybatis-plus with springboot

yl1935 opened a new issue #4230: Has error when use orchestration and mybatis-plus with springboot
URL: https://github.com/apache/incubator-shardingsphere/issues/4230
 
 
   ## Bug Report
   Project: Shading-JDBC
   Verson:4.0.0
   
   I works well on local sharding config with mybatis-plus, and I think it will works well too on orchestration config with registry, but it won't. The error message is "Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured."
   
   The springboot version is 2.2.4 and I use mybatis-plus and sharding-jdbc-orchestration-spring-boot-starter
   
           <dependency>
               <groupId>com.baomidou</groupId>
               <artifactId>mybatis-plus-boot-starter</artifactId>
               <version>3.3.1</version>
           </dependency>
           <dependency>
               <groupId>org.apache.shardingsphere</groupId>
               <artifactId>sharding-transaction-xa-core</artifactId>
               <version>4.0.0</version>
           </dependency>
           <dependency>
               <groupId>org.apache.shardingsphere</groupId>
               <artifactId>sharding-jdbc-orchestration-spring-boot-starter</artifactId>
               <version>4.0.0</version>
           </dependency>
           <dependency>
               <groupId>org.apache.shardingsphere</groupId>
               <artifactId>sharding-orchestration-reg-zookeeper-curator</artifactId>
               <version>4.0.0</version>
           </dependency>
   
   I have read the source code and compared org.apache.shardingsphere.shardingjdbc.spring.boot.SpringBootConfiguration.java(works well) with org.apache.shardingsphere.shardingjdbc.orchestration.spring.boot.OrchestrationSpringBootConfiguration.java (can not work, throws error when startup project)
   
   I found @AutoConfigureBefore(DataSourceAutoConfiguration.class) is missing in  OrchestrationSpringBootConfiguration.java, I think this is the real reason, I try to add @AutoConfigureBefore in OrchestrationSpringBootConfiguration.java and repackage and replace the local sharding-jdbc-orchestration-spring-boot-starter.jar with the jar I modified, then the error 
   has gone.
   Because mybatis-plus include spring-boot-starter-jdbc.jar, I think its DataSourceAutoConfiguration loads config before  OrchestrationSpringBootConfiguration so the error happened.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] yanyzy commented on issue #4230: Has error when use orchestration and mybatis-plus with springboot

Posted by GitBox <gi...@apache.org>.
yanyzy commented on issue #4230: Has error when use orchestration and mybatis-plus with springboot
URL: https://github.com/apache/incubator-shardingsphere/issues/4230#issuecomment-591210471
 
 
   @yl1935 
   Thanks for your feedback, would you like to submit a pull request to fix this bug? it is a good opportunity to get involved.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] terrymanu closed issue #4230: Has error when use orchestration and mybatis-plus with springboot

Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #4230: Has error when use orchestration and mybatis-plus with springboot
URL: https://github.com/apache/incubator-shardingsphere/issues/4230
 
 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services