This is an automated email from the ASF dual-hosted git repository.

ilgrosso pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/syncope.git


The following commit(s) were added to refs/heads/master by this push:
     new 386a1f0788 [SYNCOPE-1857] Do not select the internal storage db from 
classpath (#971)
386a1f0788 is described below

commit 386a1f0788b8820e5d6aa37d5836b1bee611958e
Author: Francesco Chicchiriccò <[email protected]>
AuthorDate: Wed Jan 29 12:30:26 2025 +0100

    [SYNCOPE-1857] Do not select the internal storage db from classpath (#971)
---
 core/persistence-jpa/pom.xml                         |  5 ++++-
 .../persistence/jpa/MariaDBPersistenceContext.java   |  5 +++--
 .../persistence/jpa/MySQLPersistenceContext.java     |  5 +++--
 .../persistence/jpa/OraclePersistenceContext.java    |  5 +++--
 .../core/persistence/jpa/PGPersistenceContext.java   |  6 ++++--
 .../core/persistence/jpa/PersistenceProperties.java  |  6 +++++-
 .../syncope/core/persistence/jpa/AbstractTest.java   |  2 ++
 .../core/persistence/jpa/PersistenceTestContext.java | 20 --------------------
 .../src/test/resources/core-test.properties          |  2 ++
 .../src/test/resources/simplelogger.properties       |  1 +
 core/persistence-neo4j/pom.xml                       |  1 -
 .../syncope/core/persistence/neo4j/AbstractTest.java |  2 ++
 .../persistence/neo4j/PersistenceTestContext.java    | 20 --------------------
 core/starter/src/main/resources/core.properties      |  3 +++
 .../src/main/resources/core-mariadb.properties       |  2 ++
 .../src/main/resources/core-mysql.properties         |  2 ++
 .../src/main/resources/core-oracle.properties        |  2 ++
 .../embedded/EmbeddedPostgreSQLContext.java          |  4 ++--
 pom.xml                                              |  4 ++++
 19 files changed, 44 insertions(+), 53 deletions(-)

diff --git a/core/persistence-jpa/pom.xml b/core/persistence-jpa/pom.xml
index cb0dae80fb..98e8f914be 100644
--- a/core/persistence-jpa/pom.xml
+++ b/core/persistence-jpa/pom.xml
@@ -36,6 +36,7 @@ under the License.
   <properties>
     
<syncope.connid.location>file:${bundles.directory}/</syncope.connid.location>
 
+    <DB_TYPE>POSTGRESQL</DB_TYPE>
     <jdbcdriver.groupId>org.postgresql</jdbcdriver.groupId>
     <jdbcdriver.artifactId>postgresql</jdbcdriver.artifactId>
 
@@ -148,7 +149,6 @@ under the License.
         <configuration>
           <systemPropertyVariables>
             
<syncope.connid.location>${syncope.connid.location}</syncope.connid.location>
-            <CORE_PROPERTIES>classpath:core-test.properties</CORE_PROPERTIES>
             <TESTCONTAINERS_REUSE_ENABLE>true</TESTCONTAINERS_REUSE_ENABLE>
           </systemPropertyVariables>
         </configuration>
@@ -179,6 +179,7 @@ under the License.
       <id>mysql</id>
 
       <properties>
+        <DB_TYPE>MYSQL</DB_TYPE>
         <jdbcdriver.groupId>com.mysql</jdbcdriver.groupId>
         <jdbcdriver.artifactId>mysql-connector-j</jdbcdriver.artifactId>
       </properties>
@@ -188,6 +189,7 @@ under the License.
       <id>mariadb</id>
 
       <properties>
+        <DB_TYPE>MARIADB</DB_TYPE>
         <jdbcdriver.groupId>org.mariadb.jdbc</jdbcdriver.groupId>
         <jdbcdriver.artifactId>mariadb-java-client</jdbcdriver.artifactId>
       </properties>
@@ -197,6 +199,7 @@ under the License.
       <id>oracle</id>
 
       <properties>
+        <DB_TYPE>ORACLE</DB_TYPE>
         <jdbcdriver.groupId>com.oracle.database.jdbc</jdbcdriver.groupId>
         <jdbcdriver.artifactId>ojdbc11</jdbcdriver.artifactId>
       </properties>
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/MariaDBPersistenceContext.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/MariaDBPersistenceContext.java
index e8c8b39086..4af10b53c3 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/MariaDBPersistenceContext.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/MariaDBPersistenceContext.java
@@ -35,14 +35,15 @@ import 
org.apache.syncope.core.persistence.jpa.dao.MariaDBJPAAnySearchDAO;
 import 
org.apache.syncope.core.persistence.jpa.dao.repo.MariaDBPlainSchemaRepoExtImpl;
 import org.apache.syncope.core.persistence.jpa.dao.repo.PlainSchemaRepoExt;
 import org.apache.syncope.core.persistence.jpa.entity.MariaDBEntityFactory;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
 import 
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Lazy;
 
 @Configuration(proxyBeanMethods = false)
-@ConditionalOnClass(name = "org.mariadb.jdbc.Driver")
+@ConditionalOnProperty(
+        prefix = PersistenceProperties.PREFIX, name = 
PersistenceProperties.DB_TYPE, havingValue = "MARIADB")
 public class MariaDBPersistenceContext {
 
     @ConditionalOnMissingBean
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/MySQLPersistenceContext.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/MySQLPersistenceContext.java
index 2bde40db09..2a3b61b322 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/MySQLPersistenceContext.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/MySQLPersistenceContext.java
@@ -35,14 +35,15 @@ import 
org.apache.syncope.core.persistence.jpa.dao.MySQLJPAAnySearchDAO;
 import 
org.apache.syncope.core.persistence.jpa.dao.repo.MySQLPlainSchemaRepoExtImpl;
 import org.apache.syncope.core.persistence.jpa.dao.repo.PlainSchemaRepoExt;
 import org.apache.syncope.core.persistence.jpa.entity.MySQLEntityFactory;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
 import 
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Lazy;
 
 @Configuration(proxyBeanMethods = false)
-@ConditionalOnClass(name = "com.mysql.cj.jdbc.Driver")
+@ConditionalOnProperty(
+        prefix = PersistenceProperties.PREFIX, name = 
PersistenceProperties.DB_TYPE, havingValue = "MYSQL")
 public class MySQLPersistenceContext {
 
     @ConditionalOnMissingBean
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/OraclePersistenceContext.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/OraclePersistenceContext.java
index ac25ca2f7d..ba2638c379 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/OraclePersistenceContext.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/OraclePersistenceContext.java
@@ -35,14 +35,15 @@ import 
org.apache.syncope.core.persistence.jpa.dao.OracleJPAAnySearchDAO;
 import 
org.apache.syncope.core.persistence.jpa.dao.repo.OraclePlainSchemaRepoExtImpl;
 import org.apache.syncope.core.persistence.jpa.dao.repo.PlainSchemaRepoExt;
 import org.apache.syncope.core.persistence.jpa.entity.OracleEntityFactory;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
 import 
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Lazy;
 
 @Configuration(proxyBeanMethods = false)
-@ConditionalOnClass(name = "oracle.jdbc.OracleDriver")
+@ConditionalOnProperty(
+        prefix = PersistenceProperties.PREFIX, name = 
PersistenceProperties.DB_TYPE, havingValue = "ORACLE")
 public class OraclePersistenceContext {
 
     @ConditionalOnMissingBean
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/PGPersistenceContext.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/PGPersistenceContext.java
index 00af19795c..6b3640ae1b 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/PGPersistenceContext.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/PGPersistenceContext.java
@@ -35,14 +35,16 @@ import 
org.apache.syncope.core.persistence.jpa.dao.PGJPAAnySearchDAO;
 import 
org.apache.syncope.core.persistence.jpa.dao.repo.PGPlainSchemaRepoExtImpl;
 import org.apache.syncope.core.persistence.jpa.dao.repo.PlainSchemaRepoExt;
 import org.apache.syncope.core.persistence.jpa.entity.PGEntityFactory;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
 import 
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Lazy;
 
 @Configuration(proxyBeanMethods = false)
-@ConditionalOnClass(name = "org.postgresql.Driver")
+@ConditionalOnProperty(
+        prefix = PersistenceProperties.PREFIX, name = 
PersistenceProperties.DB_TYPE, havingValue = "POSTGRESQL",
+        matchIfMissing = true)
 public class PGPersistenceContext {
 
     @ConditionalOnMissingBean
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/PersistenceProperties.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/PersistenceProperties.java
index b20daf67f7..cbee91b013 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/PersistenceProperties.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/PersistenceProperties.java
@@ -21,9 +21,13 @@ package org.apache.syncope.core.persistence.jpa;
 import 
org.apache.syncope.core.persistence.common.AbstractPersistenceProperties;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 
-@ConfigurationProperties("persistence")
+@ConfigurationProperties(PersistenceProperties.PREFIX)
 public class PersistenceProperties extends 
AbstractPersistenceProperties<DomainProperties> {
 
+    public static final String PREFIX = "persistence";
+
+    public static final String DB_TYPE = "db-type";
+
     private String remoteCommitProvider = "sjvm";
 
     private String metaDataFactory;
diff --git 
a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/AbstractTest.java
 
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/AbstractTest.java
index ce7c865b48..4e57dee352 100644
--- 
a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/AbstractTest.java
+++ 
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/AbstractTest.java
@@ -34,12 +34,14 @@ import 
org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.test.context.DynamicPropertyRegistry;
 import org.springframework.test.context.DynamicPropertySource;
+import org.springframework.test.context.TestPropertySource;
 import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
 import org.testcontainers.containers.MariaDBContainer;
 import org.testcontainers.containers.MySQLContainer;
 import org.testcontainers.oracle.OracleContainer;
 
 @SpringJUnitConfig(classes = { MasterDomain.class, 
PersistenceTestContext.class })
+@TestPropertySource("classpath:core-test.properties")
 public abstract class AbstractTest {
 
     private static String JDBC_DRIVER;
diff --git 
a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/PersistenceTestContext.java
 
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/PersistenceTestContext.java
index 6859a52e99..52e93da836 100644
--- 
a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/PersistenceTestContext.java
+++ 
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/PersistenceTestContext.java
@@ -19,8 +19,6 @@
 package org.apache.syncope.core.persistence.jpa;
 
 import jakarta.persistence.EntityManagerFactory;
-import java.util.ArrayList;
-import java.util.List;
 import javax.sql.DataSource;
 import org.apache.syncope.common.keymaster.client.api.ConfParamOps;
 import org.apache.syncope.common.keymaster.client.api.DomainOps;
@@ -42,9 +40,6 @@ import 
org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Import;
-import 
org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
-import org.springframework.core.io.DefaultResourceLoader;
-import org.springframework.core.io.Resource;
 import org.springframework.jndi.JndiObjectFactoryBean;
 
 @Import({
@@ -59,21 +54,6 @@ public class PersistenceTestContext {
 
     public static final ThreadLocal<String> TEST_DOMAIN = 
ThreadLocal.withInitial(() -> SyncopeConstants.MASTER_DOMAIN);
 
-    @Bean
-    public static PropertySourcesPlaceholderConfigurer 
propertyPlaceholderConfigurer() {
-        PropertySourcesPlaceholderConfigurer ppc = new 
PropertySourcesPlaceholderConfigurer();
-
-        DefaultResourceLoader resourceLoader = new DefaultResourceLoader();
-
-        List<Resource> locations = new ArrayList<>();
-        for (String location : 
System.getProperty("CORE_PROPERTIES").split(",")) {
-            locations.add(resourceLoader.getResource(location));
-        }
-        ppc.setLocations(locations.toArray(Resource[]::new));
-
-        return ppc;
-    }
-
     @Value("${security.adminUser}")
     private String adminUser;
 
diff --git a/core/persistence-jpa/src/test/resources/core-test.properties 
b/core/persistence-jpa/src/test/resources/core-test.properties
index 41ce20b0c7..1b3f95feeb 100644
--- a/core/persistence-jpa/src/test/resources/core-test.properties
+++ b/core/persistence-jpa/src/test/resources/core-test.properties
@@ -20,6 +20,8 @@ security.anonymousUser=${anonymousUser}
 security.jwsKey=${jwsKey}
 security.secretKey=${secretKey}
 
+persistence.db-type=${DB_TYPE}
+
 persistence.indexesXML=${INDEXES}
 persistence.viewsXML=${VIEWS}
 
diff --git a/core/persistence-jpa/src/test/resources/simplelogger.properties 
b/core/persistence-jpa/src/test/resources/simplelogger.properties
index eadbb79293..3b4bbf0968 100644
--- a/core/persistence-jpa/src/test/resources/simplelogger.properties
+++ b/core/persistence-jpa/src/test/resources/simplelogger.properties
@@ -23,3 +23,4 @@ org.slf4j.simpleLogger.defaultLogLevel=debug
 org.slf4j.simpleLogger.log.org.springframework.jdbc.core.JdbcTemplate=error
 
org.slf4j.simpleLogger.log.org.springframework.jdbc.datasource.DataSourceUtils=error
 org.slf4j.simpleLogger.log.com.github.dockerjava.zerodep.shaded=error
+org.slf4j.simpleLogger.log.org.testcontainers=error
diff --git a/core/persistence-neo4j/pom.xml b/core/persistence-neo4j/pom.xml
index 9aeb31208f..efe1ebf05e 100644
--- a/core/persistence-neo4j/pom.xml
+++ b/core/persistence-neo4j/pom.xml
@@ -134,7 +134,6 @@ under the License.
                 <include>**/*Test.java</include>
               </includes>
               <systemPropertyVariables>
-                
<CORE_PROPERTIES>classpath:core-test.properties</CORE_PROPERTIES>
                 
<NEO4J_CONTAINER_IP>${docker.container.neo4j.ip}</NEO4J_CONTAINER_IP>
                 
<NEO4J_TWO_CONTAINER_IP>${docker.container.neo4jTwo.ip}</NEO4J_TWO_CONTAINER_IP>
                 
<syncope.connid.location>file:${bundles.directory}/</syncope.connid.location>
diff --git 
a/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/AbstractTest.java
 
b/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/AbstractTest.java
index 8a4788cd61..67d9a5f8ad 100644
--- 
a/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/AbstractTest.java
+++ 
b/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/AbstractTest.java
@@ -22,9 +22,11 @@ import 
org.apache.syncope.core.persistence.api.entity.AnyUtilsFactory;
 import org.apache.syncope.core.persistence.api.entity.EntityFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.TestPropertySource;
 import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
 
 @SpringJUnitConfig(classes = { MasterDomain.class, 
PersistenceTestContext.class })
+@TestPropertySource("classpath:core-test.properties")
 @DirtiesContext
 public abstract class AbstractTest {
 
diff --git 
a/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/PersistenceTestContext.java
 
b/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/PersistenceTestContext.java
index 68947e419f..36ee823da3 100644
--- 
a/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/PersistenceTestContext.java
+++ 
b/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/PersistenceTestContext.java
@@ -18,8 +18,6 @@
  */
 package org.apache.syncope.core.persistence.neo4j;
 
-import java.util.ArrayList;
-import java.util.List;
 import javax.cache.CacheManager;
 import javax.cache.Caching;
 import org.apache.syncope.common.keymaster.client.api.ConfParamOps;
@@ -42,9 +40,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Import;
 import org.springframework.context.annotation.Primary;
-import 
org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
-import org.springframework.core.io.DefaultResourceLoader;
-import org.springframework.core.io.Resource;
 
 @Import(PersistenceContext.class)
 @Configuration(proxyBeanMethods = false)
@@ -52,21 +47,6 @@ public class PersistenceTestContext {
 
     public static final ThreadLocal<String> TEST_DOMAIN = 
ThreadLocal.withInitial(() -> SyncopeConstants.MASTER_DOMAIN);
 
-    @Bean
-    public static PropertySourcesPlaceholderConfigurer 
propertyPlaceholderConfigurer() {
-        PropertySourcesPlaceholderConfigurer ppc = new 
PropertySourcesPlaceholderConfigurer();
-
-        DefaultResourceLoader resourceLoader = new DefaultResourceLoader();
-
-        List<Resource> locations = new ArrayList<>();
-        for (String location : 
System.getProperty("CORE_PROPERTIES").split(",")) {
-            locations.add(resourceLoader.getResource(location));
-        }
-        ppc.setLocations(locations.toArray(Resource[]::new));
-
-        return ppc;
-    }
-
     @Value("${security.adminUser}")
     private String adminUser;
 
diff --git a/core/starter/src/main/resources/core.properties 
b/core/starter/src/main/resources/core.properties
index 802d7b3051..8b233065d1 100644
--- a/core/starter/src/main/resources/core.properties
+++ b/core/starter/src/main/resources/core.properties
@@ -44,6 +44,9 @@ service.discovery.address=http://localhost:8080/syncope/rest/
 # Persistence #
 ###############
 
+# acceptable values: POSTGRESQL | MYSQL | MARIADB | ORACLE
+persistence.db-type=POSTGRESQL
+
 persistence.remoteCommitProvider=sjvm
 
 persistence.domain[0].key=Master
diff --git a/fit/core-reference/src/main/resources/core-mariadb.properties 
b/fit/core-reference/src/main/resources/core-mariadb.properties
index 7af7cf533c..50bb11fb73 100644
--- a/fit/core-reference/src/main/resources/core-mariadb.properties
+++ b/fit/core-reference/src/main/resources/core-mariadb.properties
@@ -15,6 +15,8 @@
 # specific language governing permissions and limitations
 # under the License.
 
+persistence.db-type=MARIADB
+
 persistence.indexesXML=classpath:META-INF/mariadb/indexes.xml
 persistence.viewsXML=classpath:META-INF/mariadb/views.xml
 
diff --git a/fit/core-reference/src/main/resources/core-mysql.properties 
b/fit/core-reference/src/main/resources/core-mysql.properties
index f18b05d310..42299ebddf 100644
--- a/fit/core-reference/src/main/resources/core-mysql.properties
+++ b/fit/core-reference/src/main/resources/core-mysql.properties
@@ -15,6 +15,8 @@
 # specific language governing permissions and limitations
 # under the License.
 
+persistence.db-type=MYSQL
+
 persistence.indexesXML=classpath:META-INF/mysql/indexes.xml
 persistence.viewsXML=classpath:META-INF/mysql/views.xml
 
diff --git a/fit/core-reference/src/main/resources/core-oracle.properties 
b/fit/core-reference/src/main/resources/core-oracle.properties
index d341779e1a..52aac1e27a 100644
--- a/fit/core-reference/src/main/resources/core-oracle.properties
+++ b/fit/core-reference/src/main/resources/core-oracle.properties
@@ -15,6 +15,8 @@
 # specific language governing permissions and limitations
 # under the License.
 
+persistence.db-type=ORACLE
+
 persistence.indexesXML=classpath:META-INF/oracle/indexes.xml
 persistence.viewsXML=classpath:META-INF/oracle/views.xml
 
diff --git 
a/fit/persistence-embedded/src/main/java/org/apache/syncope/fit/persistence/embedded/EmbeddedPostgreSQLContext.java
 
b/fit/persistence-embedded/src/main/java/org/apache/syncope/fit/persistence/embedded/EmbeddedPostgreSQLContext.java
index aeb6891fc4..a5c4fba414 100644
--- 
a/fit/persistence-embedded/src/main/java/org/apache/syncope/fit/persistence/embedded/EmbeddedPostgreSQLContext.java
+++ 
b/fit/persistence-embedded/src/main/java/org/apache/syncope/fit/persistence/embedded/EmbeddedPostgreSQLContext.java
@@ -32,7 +32,7 @@ import javax.sql.DataSource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.context.annotation.Bean;
 import org.springframework.core.env.Environment;
 import org.springframework.jndi.JndiObjectFactoryBean;
@@ -87,7 +87,7 @@ public class EmbeddedPostgreSQLContext {
         }
     }
 
-    @ConditionalOnClass(name = "org.postgresql.Driver")
+    @ConditionalOnProperty(prefix = "persistence", name = "db-type", 
havingValue = "POSTGRESQL", matchIfMissing = true)
     @Bean(name = "MasterDataSource")
     public JndiObjectFactoryBean masterDataSource(final Environment env) 
throws SQLException {
         String dbhost = env.getProperty("POSTGRES_HOST", 
DEFAULT_POSTGRES_HOST);
diff --git a/pom.xml b/pom.xml
index c5b6cf8fb8..2a4296ec6c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -684,6 +684,10 @@ under the License.
             <groupId>org.hibernate.orm</groupId>
             <artifactId>hibernate-core</artifactId>
           </exclusion>
+          <exclusion>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-logging</artifactId>
+          </exclusion>
         </exclusions>
       </dependency>
 

Reply via email to