Skip to content

Commit

Permalink
📌 shardingsphere and jakarta EE #169
Browse files Browse the repository at this point in the history
  • Loading branch information
trydofor committed Dec 25, 2023
1 parent 9669c99 commit 2e50da8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
11 changes: 11 additions & 0 deletions wings/faceless-shard/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@
<groupId>pro.fessional.wings</groupId>
<artifactId>faceless-awesome</artifactId>
</dependency>
<!-- shardingsphere and jakarta EE #169 -->
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.8</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.33</version>
</dependency>
<!--sharding sphere-->
<dependency>
<groupId>org.apache.shardingsphere</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.shardingsphere.driver.jdbc.core.driver.ShardingSphereDriverURLManager;
import org.apache.shardingsphere.driver.jdbc.core.driver.ShardingSphereURLManager;
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.infra.yaml.config.pojo.YamlRootConfiguration;
import org.apache.shardingsphere.infra.yaml.config.swapper.resource.YamlDataSourceConfigurationSwapper;
Expand Down Expand Up @@ -36,7 +36,8 @@ public DataSourceContext.Customizer shardingDataSourceContext(@Value("${spring.d
return ignored -> false;
}

final byte[] yamlBytes = ShardingSphereDriverURLManager.getContent(jdbcUrl);
// final byte[] yamlBytes = ShardingSphereDriverURLManager.getContent(jdbcUrl);
final byte[] yamlBytes = ShardingSphereURLManager.getContent(jdbcUrl, "jdbc:shardingsphere:");
YamlRootConfiguration rootConfig = YamlEngine.unmarshal(yamlBytes, YamlRootConfiguration.class);
final YamlDataSourceConfigurationSwapper configurationSwapper = new YamlDataSourceConfigurationSwapper();
final Map<String, DataSource> dsMap = configurationSwapper.swapToDataSources(rootConfig.getDataSources());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,6 @@ rules:
type: INLINE
props:
algorithm-expression: tst_sharding_$->{id % 5}
- !SINGLE
tables:
- "*.*"

0 comments on commit 2e50da8

Please sign in to comment.