diff --git a/.gitignore b/.gitignore index caa1df6a..2e0738ea 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,6 @@ build/ ### VS Code ### .vscode/ + +## jte ## +/jte-classes/** diff --git a/api-rest/src/main/java/com/homihq/db2rest/jdbc/config/JdbcConfiguration.java b/api-rest/src/main/java/com/homihq/db2rest/jdbc/config/JdbcConfiguration.java index 28322def..e09a9787 100644 --- a/api-rest/src/main/java/com/homihq/db2rest/jdbc/config/JdbcConfiguration.java +++ b/api-rest/src/main/java/com/homihq/db2rest/jdbc/config/JdbcConfiguration.java @@ -76,8 +76,10 @@ public DataSource dataSource() { private Map buildDataSources() { final Map result = new HashMap<>(); - if(Objects.isNull(databaseProperties.getDatabases())) { - log.info("*** No database configured."); + log.info("Databases - {}", databaseProperties.getDatabases()); + + if(databaseProperties.isRdbmsConfigured()) { + log.info("*** No RDBMS configured."); return result; } diff --git a/rest-common/src/main/java/com/homihq/db2rest/multidb/DatabaseConnectionDetail.java b/rest-common/src/main/java/com/homihq/db2rest/multidb/DatabaseConnectionDetail.java index 4b9ffbf7..167b82ec 100644 --- a/rest-common/src/main/java/com/homihq/db2rest/multidb/DatabaseConnectionDetail.java +++ b/rest-common/src/main/java/com/homihq/db2rest/multidb/DatabaseConnectionDetail.java @@ -14,7 +14,8 @@ public boolean isMongo() { } public boolean isJdbcPresent() { - return StringUtils.isNoneBlank(url); + return StringUtils.isNoneBlank(url) + && !StringUtils.equalsIgnoreCase(url, "${DB_URL}"); } public boolean includeAllSchemas() { diff --git a/rest-common/src/main/java/com/homihq/db2rest/multidb/DatabaseProperties.java b/rest-common/src/main/java/com/homihq/db2rest/multidb/DatabaseProperties.java index 7ebb0b27..4d76809b 100644 --- a/rest-common/src/main/java/com/homihq/db2rest/multidb/DatabaseProperties.java +++ b/rest-common/src/main/java/com/homihq/db2rest/multidb/DatabaseProperties.java @@ -2,16 +2,19 @@ import lombok.Data; import lombok.Getter; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; import java.util.List; +import java.util.Objects; import java.util.Optional; @Data @Component @ConfigurationProperties(prefix = "app") +@Slf4j public class DatabaseProperties { @@ -23,4 +26,16 @@ public Optional getDatabase(String dbId) { .filter(databaseConnectionDetail -> StringUtils.equalsIgnoreCase(dbId, databaseConnectionDetail.id())) .findFirst(); } + + public boolean isRdbmsConfigured() { + if(Objects.isNull(databases)) { + log.info("*** No RDBMS configured."); + return false; + } + + return databases.stream() + .anyMatch(DatabaseConnectionDetail::isJdbcPresent); + + + } }