Skip to content

Commit

Permalink
2025-01-05 05:32:35
Browse files Browse the repository at this point in the history
  • Loading branch information
yingzhuo committed Jan 4, 2025
1 parent f204f29 commit f30aad4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.boot.autoconfigure.jdbc.JdbcConnectionDetails;

import java.io.Serializable;
Expand All @@ -12,6 +13,7 @@
*/
@Getter
@Setter
@ToString
public class HikariProperties implements JdbcConnectionDetails, Serializable {

private String jdbcUrl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.util.Assert;

import java.io.Serializable;
import java.util.Map;
Expand All @@ -13,11 +16,18 @@
*/
@Getter
@Setter
@ToString
@ConfigurationProperties(prefix = "springturbo.routing-data-source")
public class RoutingDataSourceProperties implements Serializable {
public class RoutingDataSourceProperties implements Serializable, InitializingBean {

private boolean enabled = true;
private String defaultDataSourceName;
private Map<String, HikariProperties> hikariDataSources;

@Override
public void afterPropertiesSet() {
Assert.hasText(defaultDataSourceName, "defaultDataSourceName is required");
Assert.notEmpty(hikariDataSources, "hikariDataSources is empty");
}

}

0 comments on commit f30aad4

Please sign in to comment.