配置文件修改
表映射配置 放在application.yml
This commit is contained in:
@@ -49,22 +49,11 @@ public class ShardingConfig {
|
||||
*/
|
||||
private String centerTablesDataNode;
|
||||
|
||||
@Value("${center-tables}")
|
||||
private String tableNamesAsString;
|
||||
|
||||
/**
|
||||
* 中心表,不进行分库操作
|
||||
*/
|
||||
// @Value("${center-tables}")
|
||||
private Set<String> centerTables;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
// 使用换行符进行分割,然后去除空白字符,收集到Set集合中
|
||||
centerTables = Arrays.stream(tableNamesAsString.split(","))
|
||||
.map(String::trim)
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
private List<String> centerTables;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user