Skip to content

Commit

Permalink
minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
JakimLi committed Aug 7, 2020
1 parent bb380c7 commit 7358bb8
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,14 @@ private DataSource buildDataSource(DatasourceProperties property) {

@PostConstruct
public void validateAdditionalDataSourceName() {
if (configuration.hasAdditional() && configuration.getAdditional().stream()
.anyMatch(property -> DEFAULT.equalsIgnoreCase(property.getName()))) {
if (configuration.hasAdditional() && usingReservedName(DEFAULT)) {
throw new RuntimeException(String.format("datasource name: '%s' is reserved", DEFAULT));
}
}

private boolean usingReservedName(String name) {
return configuration.getAdditional()
.stream()
.anyMatch(property -> name.equalsIgnoreCase(property.getName()));
}
}

0 comments on commit 7358bb8

Please sign in to comment.