jdxia commented on issue #35123: URL: https://github.com/apache/shardingsphere/issues/35123#issuecomment-2769284150
My solution is to write a datasource myself ``` @Configuration public class DataSourceConfig { @Value("${spring.datasource.url}") private String dataSourceUrl; @Bean public DataSource dataSource() { return new ShardingDataSouce(dataSourceUrl); } } ``` ``` ublic class ShardingDataSouce implements DataSource { protected volatile String jdbcUrl; protected PrintWriter logWriter = new PrintWriter(System.out); private ShardingSphereDriver shardingSphereDriver = new ShardingSphereDriver(); public ShardingDataSouce(String jdbcUrl) { this.jdbcUrl = jdbcUrl; } @Override public Connection getConnection() throws SQLException { if (jdbcUrl == null || jdbcUrl.isEmpty()) { throw new RuntimeException("jdbcUrl is empty"); } return shardingSphereDriver.connect(jdbcUrl, null); } @Override public Connection getConnection(String username, String password) throws SQLException { return getConnection(); } @Override public PrintWriter getLogWriter() throws SQLException { return logWriter; } @Override public void setLogWriter(PrintWriter out) throws SQLException { } @Override public void setLoginTimeout(int seconds) throws SQLException { } @Override public int getLoginTimeout() throws SQLException { return 0; } @Override public Logger getParentLogger() throws SQLFeatureNotSupportedException { return null; } @Override public <T> T unwrap(Class<T> iface) throws SQLException { return null; } @Override public boolean isWrapperFor(Class<?> iface) throws SQLException { return false; } } ``` -- 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-unsubscr...@shardingsphere.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org