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/11/23 10:46:23 UTC
[GitHub] [shardingsphere] MrXionGe opened a new issue #8306: IT DOES NOT WORK WITH SPRING-BOOT 2.3.X ?
MrXionGe opened a new issue #8306:
URL: https://github.com/apache/shardingsphere/issues/8306
## Version
OpenJDK 11
spring-boot 2.3.4 & 2.4.0
shardingsphere-jdbc-core-spring-boot-starter 5.0.0-alpha
## Question
It does not seem to read the configuration correctly(yml or properties).
When I start, an exception is thrown. (message = No value bound)
```
java.lang.reflect.InvocationTargetException: null
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.apache.shardingsphere.spring.boot.util.PropertyUtil.v2(PropertyUtil.java:111) ~[shardingsphere-jdbc-spring-boot-starter-infra-5.0.0-alpha.jar:5.0.0-alpha]
at org.apache.shardingsphere.spring.boot.util.PropertyUtil.handle(PropertyUtil.java:75) ~[shardingsphere-jdbc-spring-boot-starter-infra-5.0.0-alpha.jar:5.0.0-alpha]
at org.apache.shardingsphere.spring.boot.registry.AbstractAlgorithmProvidedBeanRegistry.lambda$registerBean$1(AbstractAlgorithmProvidedBeanRegistry.java:57) ~[shardingsphere-jdbc-spring-boot-starter-infra-5.0.0-alpha.jar:5.0.0-alpha]
at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
at org.apache.shardingsphere.spring.boot.registry.AbstractAlgorithmProvidedBeanRegistry.registerBean(AbstractAlgorithmProvidedBeanRegistry.java:55) ~[shardingsphere-jdbc-spring-boot-starter-infra-5.0.0-alpha.jar:5.0.0-alpha]
at org.apache.shardingsphere.replicaquery.spring.boot.algorithm.ReplicaQueryAlgorithmProvidedBeanRegistry.postProcessBeanDefinitionRegistry(ReplicaQueryAlgorithmProvidedBeanRegistry.java:43) ~[shardingsphere-replica-query-spring-boot-starter-5.0.0-alpha.jar:5.0.0-alpha]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:285) ~[spring-context-5.3.1.jar:5.3.1]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:129) ~[spring-context-5.3.1.jar:5.3.1]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:751) ~[spring-context-5.3.1.jar:5.3.1]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:569) ~[spring-context-5.3.1.jar:5.3.1]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767) ~[spring-boot-2.4.0.jar:2.4.0]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) ~[spring-boot-2.4.0.jar:2.4.0]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426) ~[spring-boot-2.4.0.jar:2.4.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) ~[spring-boot-2.4.0.jar:2.4.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1309) ~[spring-boot-2.4.0.jar:2.4.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1298) ~[spring-boot-2.4.0.jar:2.4.0]
at cn.mrxionge.replicaquery.ReplicaQueryApplication.main(ReplicaQueryApplication.java:10) ~[classes/:na]
Caused by: java.util.NoSuchElementException: No value bound
at org.springframework.boot.context.properties.bind.BindResult.get(BindResult.java:55) ~[spring-boot-2.4.0.jar:2.4.0]
... 21 common frames omitted
```
When spring-boot is downgraded to 1.5.X. Run successfully!
----------------------------------------------------------------
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
[GitHub] [shardingsphere] yu199195 commented on issue #8306: IT DOES NOT WORK WITH SPRING-BOOT 2.3.X ?
Posted by GitBox <gi...@apache.org>.
yu199195 commented on issue #8306:
URL: https://github.com/apache/shardingsphere/issues/8306#issuecomment-732120279
@MrXionGe
Hi, you can config this :
```
spring.shardingsphere.datasource.common.type=com.zaxxer.hikari.HikariDataSource
spring.shardingsphere.datasource.common.driver-class-name=com.mysql.jdbc.Driver
spring.shardingsphere.datasource.common.username=root
spring.shardingsphere.datasource.common.password= 123456
spring.shardingsphere.datasource.ds_0.jdbc-url=jdbc:mysql://192.169.2.29:3306/demo_ds_0?serverTimezone=UTC&useSSL=false
spring.shardingsphere.datasource.ds_1.jdbc-url=jdbc:mysql://192.169.2.29:3306/demo_ds_1?serverTimezone=UTC&useSSL=false
```
why:
if you not config datasource common , in springboot 2.4 May be NullpointExcepiton
you also see #8299
----------------------------------------------------------------
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
[GitHub] [shardingsphere] MrXionGe edited a comment on issue #8306: IT DOES NOT WORK WITH SPRING-BOOT 2.3.X ?
Posted by GitBox <gi...@apache.org>.
MrXionGe edited a comment on issue #8306:
URL: https://github.com/apache/shardingsphere/issues/8306#issuecomment-732081270
@terrymanu
## Config File
##### application.properties
```
spring.profiles.active=replica-query
```
##### application-replica-query.properties
```
spring.shardingsphere.datasource.names=primary_ds,replica_ds_0,replica_ds_1
spring.shardingsphere.datasource.primary_ds.jdbc-url=jdbc:mysql://127.0.0.1:3306/db_master?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
spring.shardingsphere.datasource.primary_ds.type=com.zaxxer.hikari.HikariDataSource
spring.shardingsphere.datasource.primary_ds.driver-class-name=com.mysql.cj.jdbc.Driver
spring.shardingsphere.datasource.primary_ds.username=web_app
spring.shardingsphere.datasource.primary_ds.password=123456
spring.shardingsphere.datasource.replica_ds_0.jdbc-url=jdbc:mysql://127.0.0.1:3306/db_read_0?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
spring.shardingsphere.datasource.replica_ds_0.type=com.zaxxer.hikari.HikariDataSource
spring.shardingsphere.datasource.replica_ds_0.driver-class-name=com.mysql.cj.jdbc.Driver
spring.shardingsphere.datasource.replica_ds_0.username=web_app
spring.shardingsphere.datasource.replica_ds_0.password=123456
spring.shardingsphere.datasource.replica_ds_1.jdbc-url=jdbc:mysql://127.0.0.1:3306/db_read_1?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
spring.shardingsphere.datasource.replica_ds_1.type=com.zaxxer.hikari.HikariDataSource
spring.shardingsphere.datasource.replica_ds_1.driver-class-name=com.mysql.cj.jdbc.Driver
spring.shardingsphere.datasource.replica_ds_1.username=web_app
spring.shardingsphere.datasource.replica_ds_1.password=123456
spring.shardingsphere.rules.replica-query.load-balancers.round-robin.type=ROUND_ROBIN
spring.shardingsphere.rules.replica-query.data-sources.pr_ds.primary-data-source-name=primary_ds
spring.shardingsphere.rules.replica-query.data-sources.pr_ds.replica-data-source-names=replica_ds_0,replica_ds_1
spring.shardingsphere.rules.replica-query.data-sources.pr_ds.load-balancer-name=round-robin
```
----------------------------------------------------------------
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
[GitHub] [shardingsphere] MrXionGe commented on issue #8306: IT DOES NOT WORK WITH SPRING-BOOT 2.3.X ?
Posted by GitBox <gi...@apache.org>.
MrXionGe commented on issue #8306:
URL: https://github.com/apache/shardingsphere/issues/8306#issuecomment-732082493
Examples of reference
https://github.com/apache/shardingsphere/blob/master/examples/shardingsphere-jdbc-example/sharding-example/sharding-spring-boot-mybatis-example/src/main/resources/application-replica-query.properties
----------------------------------------------------------------
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
[GitHub] [shardingsphere] yu199195 commented on issue #8306: IT DOES NOT WORK WITH SPRING-BOOT 2.3.X ?
Posted by GitBox <gi...@apache.org>.
yu199195 commented on issue #8306:
URL: https://github.com/apache/shardingsphere/issues/8306#issuecomment-732796572
@MrXionGe because you use springboot 2.X, if not config this, will NullPointEx.
```
spring.shardingsphere.rules.replica-query.load-balancers.round-robin.props.workid=123
```
----------------------------------------------------------------
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
[GitHub] [shardingsphere] yu199195 closed issue #8306: IT DOES NOT WORK WITH SPRING-BOOT 2.3.X ?
Posted by GitBox <gi...@apache.org>.
yu199195 closed issue #8306:
URL: https://github.com/apache/shardingsphere/issues/8306
----------------------------------------------------------------
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
[GitHub] [shardingsphere] MrXionGe commented on issue #8306: IT DOES NOT WORK WITH SPRING-BOOT 2.3.X ?
Posted by GitBox <gi...@apache.org>.
MrXionGe commented on issue #8306:
URL: https://github.com/apache/shardingsphere/issues/8306#issuecomment-732530389
## pom.xml
```
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<relativePath/>
</parent>
<groupId>cn.mrxionge</groupId>
<artifactId>replica-query</artifactId>
<version>1.0-SNAPSHOT</version>
<name>replica-query</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<!-- spring -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.16</version>
<scope>provided</scope>
</dependency>
<!-- DAO -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.22</version>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>3.4.5</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.1</version>
</dependency>
<!-- sharding-jdbc -->
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
<version>5.0.0-alpha</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
```
## application.properties
```
spring.shardingsphere.datasource.names=ds_0,ds_1
spring.shardingsphere.enabled=true
spring.shardingsphere.datasource.common.type=com.zaxxer.hikari.HikariDataSource
spring.shardingsphere.datasource.common.driver-class-name=com.mysql.jdbc.Driver
spring.shardingsphere.datasource.common.username=web_app
spring.shardingsphere.datasource.common.password= 123456
spring.shardingsphere.datasource.ds_0.jdbc-url=jdbc:mysql://127.0.0.1:3306/db_master?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
spring.shardingsphere.datasource.ds_1.jdbc-url=jdbc:mysql://127.0.0.1:3306/db_read?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
spring.shardingsphere.rules.replica-query.load-balancers.round-robin.type=ROUND_ROBIN
spring.shardingsphere.rules.replica-query.data-sources.ds.primary-data-source-name=ds_0
spring.shardingsphere.rules.replica-query.data-sources.ds.replica-data-source-names=ds_1
spring.shardingsphere.rules.replica-query.data-sources.ds.load-balancer-name=round-robin
```
## ReplicaQueryApplication
```
package cn.mrxionge.replicaquery;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ReplicaQueryApplication {
public static void main(String[] args) {
SpringApplication.run(ReplicaQueryApplication.class, args);
}
}
```
----------------------------------------------------------------
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
[GitHub] [shardingsphere] MrXionGe commented on issue #8306: IT DOES NOT WORK WITH SPRING-BOOT 2.3.X ?
Posted by GitBox <gi...@apache.org>.
MrXionGe commented on issue #8306:
URL: https://github.com/apache/shardingsphere/issues/8306#issuecomment-732523276
@yu199195
```
spring.shardingsphere.datasource.names=ds_0,ds_1
spring.shardingsphere.datasource.common.type=com.zaxxer.hikari.HikariDataSource
spring.shardingsphere.datasource.common.driver-class-name=com.mysql.jdbc.Driver
spring.shardingsphere.datasource.common.username=web_app
spring.shardingsphere.datasource.common.password= 123456
spring.shardingsphere.datasource.ds_0.jdbc-url=jdbc:mysql://127.0.0.1:3306/db_master?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
spring.shardingsphere.datasource.ds_1.jdbc-url=jdbc:mysql://127.0.0.1:3306/db_read?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
spring.shardingsphere.rules.replica-query.load-balancers.round-robin.type=ROUND_ROBIN
spring.shardingsphere.rules.replica-query.data-sources.ds.primary-data-source-name=ds_0
spring.shardingsphere.rules.replica-query.data-sources.ds.replica-data-source-names=ds_1
spring.shardingsphere.rules.replica-query.data-sources.ds.load-balancer-name=round-robin
```
I tried your solution. It's the same exception.
----------------------------------------------------------------
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
[GitHub] [shardingsphere] MrXionGe commented on issue #8306: IT DOES NOT WORK WITH SPRING-BOOT 2.3.X ?
Posted by GitBox <gi...@apache.org>.
MrXionGe commented on issue #8306:
URL: https://github.com/apache/shardingsphere/issues/8306#issuecomment-732801826
@yu199195
Thank you so much!
And. Can version 5.0.0-alpha be used in a production environment?
I hope the documents and examples can be more complete about 5.x.
----------------------------------------------------------------
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
[GitHub] [shardingsphere] yu199195 commented on issue #8306: IT DOES NOT WORK WITH SPRING-BOOT 2.3.X ?
Posted by GitBox <gi...@apache.org>.
yu199195 commented on issue #8306:
URL: https://github.com/apache/shardingsphere/issues/8306#issuecomment-732785308
@MrXionGe hi, you also config this:
```
spring.shardingsphere.rules.replica-query.load-balancers.round-robin.type=ROUND_ROBIN
spring.shardingsphere.rules.replica-query.load-balancers.round-robin.props.workid=123
spring.shardingsphere.rules.replica-query.data-sources.pr_ds.primary-data-source-name=primary_ds
spring.shardingsphere.rules.replica-query.data-sources.pr_ds.replica-data-source-names=replica_ds_0,replica_ds_1
spring.shardingsphere.rules.replica-query.data-sources.pr_ds.load-balancer-name=round-robin
```
----------------------------------------------------------------
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
[GitHub] [shardingsphere] yu199195 commented on issue #8306: IT DOES NOT WORK WITH SPRING-BOOT 2.3.X ?
Posted by GitBox <gi...@apache.org>.
yu199195 commented on issue #8306:
URL: https://github.com/apache/shardingsphere/issues/8306#issuecomment-732796772
@MrXionGe There are no other questions, and we'll close it~
----------------------------------------------------------------
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
[GitHub] [shardingsphere] yu199195 commented on issue #8306: IT DOES NOT WORK WITH SPRING-BOOT 2.3.X ?
Posted by GitBox <gi...@apache.org>.
yu199195 commented on issue #8306:
URL: https://github.com/apache/shardingsphere/issues/8306#issuecomment-732810555
@MrXionGe documents is right, but examples vesion with springboot be later... we will close this issue!
----------------------------------------------------------------
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
[GitHub] [shardingsphere] MrXionGe commented on issue #8306: IT DOES NOT WORK WITH SPRING-BOOT 2.3.X ?
Posted by GitBox <gi...@apache.org>.
MrXionGe commented on issue #8306:
URL: https://github.com/apache/shardingsphere/issues/8306#issuecomment-732081270
## Config File
##### application.properties
```
spring.profiles.active=replica-query
```
##### application-replica-query.properties
```
spring.shardingsphere.datasource.names=primary_ds,replica_ds_0,replica_ds_1
spring.shardingsphere.datasource.primary_ds.jdbc-url=jdbc:mysql://127.0.0.1:3306/db_master?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
spring.shardingsphere.datasource.primary_ds.type=com.zaxxer.hikari.HikariDataSource
spring.shardingsphere.datasource.primary_ds.driver-class-name=com.mysql.cj.jdbc.Driver
spring.shardingsphere.datasource.primary_ds.username=web_app
spring.shardingsphere.datasource.primary_ds.password=123456
spring.shardingsphere.datasource.replica_ds_0.jdbc-url=jdbc:mysql://127.0.0.1:3306/db_read_0?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
spring.shardingsphere.datasource.replica_ds_0.type=com.zaxxer.hikari.HikariDataSource
spring.shardingsphere.datasource.replica_ds_0.driver-class-name=com.mysql.cj.jdbc.Driver
spring.shardingsphere.datasource.replica_ds_0.username=web_app
spring.shardingsphere.datasource.replica_ds_0.password=123456
spring.shardingsphere.datasource.replica_ds_1.jdbc-url=jdbc:mysql://127.0.0.1:3306/db_read_1?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
spring.shardingsphere.datasource.replica_ds_1.type=com.zaxxer.hikari.HikariDataSource
spring.shardingsphere.datasource.replica_ds_1.driver-class-name=com.mysql.cj.jdbc.Driver
spring.shardingsphere.datasource.replica_ds_1.username=web_app
spring.shardingsphere.datasource.replica_ds_1.password=123456
spring.shardingsphere.rules.replica-query.load-balancers.round-robin.type=ROUND_ROBIN
spring.shardingsphere.rules.replica-query.data-sources.pr_ds.primary-data-source-name=primary_ds
spring.shardingsphere.rules.replica-query.data-sources.pr_ds.replica-data-source-names=replica_ds_0,replica_ds_1
spring.shardingsphere.rules.replica-query.data-sources.pr_ds.load-balancer-name=round-robin
```
----------------------------------------------------------------
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
[GitHub] [shardingsphere] terrymanu commented on issue #8306: IT DOES NOT WORK WITH SPRING-BOOT 2.3.X ?
Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #8306:
URL: https://github.com/apache/shardingsphere/issues/8306#issuecomment-732079915
What is your config?
----------------------------------------------------------------
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
[GitHub] [shardingsphere] MrXionGe commented on issue #8306: IT DOES NOT WORK WITH SPRING-BOOT 2.3.X ?
Posted by GitBox <gi...@apache.org>.
MrXionGe commented on issue #8306:
URL: https://github.com/apache/shardingsphere/issues/8306#issuecomment-732794871
@yu199195
Thanks a lot!
## Config Example 1
```
spring.shardingsphere.datasource.names=ds_0,ds_1
spring.shardingsphere.datasource.ds_0.jdbc-url=jdbc:mysql://127.0.0.1:3306/db_master?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
spring.shardingsphere.datasource.ds_0.type=com.zaxxer.hikari.HikariDataSource
spring.shardingsphere.datasource.ds_0.driver-class-name=com.mysql.jdbc.Driver
spring.shardingsphere.datasource.ds_0.username=web_app
spring.shardingsphere.datasource.ds_0.password= 123456
spring.shardingsphere.datasource.ds_1.jdbc-url=jdbc:mysql://127.0.0.1:3306/db_read?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
spring.shardingsphere.datasource.ds_1.type=com.zaxxer.hikari.HikariDataSource
spring.shardingsphere.datasource.ds_1.driver-class-name=com.mysql.jdbc.Driver
spring.shardingsphere.datasource.ds_1.username=web_app
spring.shardingsphere.datasource.ds_1.password= 123456
spring.shardingsphere.rules.replica-query.load-balancers.round-robin.type=ROUND_ROBIN
spring.shardingsphere.rules.replica-query.data-sources.pr_ds.primary-data-source-name=ds_0
spring.shardingsphere.rules.replica-query.data-sources.pr_ds.replica-data-source-names=ds_01
spring.shardingsphere.rules.replica-query.data-sources.pr_ds.load-balancer-name=round-robin
```
## Config Example 2
```
spring.shardingsphere.datasource.names=ds_0,ds_1
spring.shardingsphere.datasource.common.type=com.zaxxer.hikari.HikariDataSource
spring.shardingsphere.datasource.common.driver-class-name=com.mysql.jdbc.Driver
spring.shardingsphere.datasource.common.username=web_app
spring.shardingsphere.datasource.common.password= 123456
spring.shardingsphere.datasource.ds_0.jdbc-url=jdbc:mysql://127.0.0.1:3306/db_master?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
spring.shardingsphere.datasource.ds_1.jdbc-url=jdbc:mysql://127.0.0.1:3306/db_read?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
spring.shardingsphere.rules.replica-query.load-balancers.round-robin.type=ROUND_ROBIN
spring.shardingsphere.rules.replica-query.data-sources.pr_ds.primary-data-source-name=ds_0
spring.shardingsphere.rules.replica-query.data-sources.pr_ds.replica-data-source-names=ds_01
spring.shardingsphere.rules.replica-query.data-sources.pr_ds.load-balancer-name=round-robin
```
I tried the above two examples and failed. The same 'Exception Message'
#### pom.xml
```
<!-- sharding-jdbc -->
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
<version>5.0.0-alpha</version>
</dependency>
```
----------------------------------------------------------------
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