DB 검증 profile 추가
This commit is contained in:
@@ -58,29 +58,34 @@ public class PortalDatasourceConfiguration extends BaseDatasourceConfiguration {
|
||||
@Primary
|
||||
@Bean
|
||||
public DataSource portalDataSource(EmsDatasourceProperty emsProp) {
|
||||
DataSource dataSource = null;
|
||||
|
||||
// JNDI 이용
|
||||
if (StringUtils.isNotEmpty(emsProp.getJndiName())) {
|
||||
try {
|
||||
return this.jndiLookup(emsProp.getJndiName());
|
||||
dataSource = this.jndiLookup(emsProp.getJndiName());
|
||||
} catch (NamingException e) {
|
||||
log.warn("JNDI lookup failed.", e);
|
||||
}
|
||||
}
|
||||
|
||||
log.info("개발환경을 위해 JNDI 대신 직접 DB 접속 시도");
|
||||
if (dataSource == null) {
|
||||
log.info("개발환경을 위해 JNDI 대신 직접 DB 접속 시도");
|
||||
|
||||
// JNDI 실패시 직접 접속 이용
|
||||
if (StringUtils.isEmpty(emsProp.getJdbcUrl())) {
|
||||
throw new IllegalArgumentException("DB 접속을 위한 JNDI 또는 서버 접속 정보가 설정되어 있지 않음");
|
||||
// JNDI 실패시 직접 접속 이용
|
||||
if (StringUtils.isEmpty(emsProp.getJdbcUrl())) {
|
||||
throw new IllegalArgumentException("DB 접속을 위한 JNDI 또는 서버 접속 정보가 설정되어 있지 않음");
|
||||
}
|
||||
|
||||
dataSource = createDataSource(emsProp);
|
||||
}
|
||||
|
||||
DataSource dataSource = createDataSource(emsProp);
|
||||
|
||||
if (env.matchesProfiles("db_check")) {
|
||||
if (dataSource != null && env.matchesProfiles("db_check")) {
|
||||
DatabaseSessionVerifier verifier = new DatabaseSessionVerifier(dataSource);
|
||||
verifier.afterSingletonsInstantiated();
|
||||
}
|
||||
|
||||
|
||||
return dataSource;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user