멀티태넌스 동작 확인
This commit is contained in:
@@ -113,13 +113,5 @@
|
|||||||
<prop key="hibernate.bytecode.use_reflection_optimizer">false</prop>
|
<prop key="hibernate.bytecode.use_reflection_optimizer">false</prop>
|
||||||
|
|
||||||
<prop key="hibernate.integration.envers.enabled">false</prop>
|
<prop key="hibernate.integration.envers.enabled">false</prop>
|
||||||
|
|
||||||
<prop key="hibernate.multiTenancy">SCHEMA</prop>
|
|
||||||
<prop key="hibernate.multi_tenant_connection_provider">
|
|
||||||
com.eactive.eai.rms.data.config.ConfigurableMultiTenantConnectionProvider
|
|
||||||
</prop>
|
|
||||||
<prop key="hibernate.tenant_identifier_resolver">
|
|
||||||
com.eactive.eai.rms.data.config.TenantIdentifierResolver
|
|
||||||
</prop>
|
|
||||||
</util:properties>
|
</util:properties>
|
||||||
</beans>
|
</beans>
|
||||||
+6
-7
@@ -47,20 +47,19 @@ compileJava {
|
|||||||
}
|
}
|
||||||
|
|
||||||
war {
|
war {
|
||||||
def profile = project.findProperty("profile") ?: "weblogic"
|
def profile = project.findProperty("profile") ?: "tomcat"
|
||||||
|
|
||||||
if (profile == "weblogic") {
|
if (profile == "weblogic") {
|
||||||
webXml = file("WebContent/WEB-INF/weblogic-web.xml")
|
webXml = file("WebContent/WEB-INF/weblogic-web.xml")
|
||||||
} else {
|
}
|
||||||
webXml = file("WebContent/WEB-INF/web.xml")
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// rootSpec.exclude '**/persistence.xml'
|
// rootSpec.exclude '**/persistence.xml'
|
||||||
exclude '**/context.xml'
|
exclude '**/context.xml'
|
||||||
archiveFileName = "eapim-admin.war"
|
archiveFileName = "eapim-admin.war"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tasks.withType(JavaCompile) {
|
tasks.withType(JavaCompile) {
|
||||||
options.encoding = 'UTF-8'
|
options.encoding = 'UTF-8'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,3 +46,11 @@ eLink 모듈을 참조하여 구성되어있으며, 추후 필요 모듈외에
|
|||||||
-Dfile.encoding=utf-8
|
-Dfile.encoding=utf-8
|
||||||
-DLOGBACK_LOG_LEVEL=info
|
-DLOGBACK_LOG_LEVEL=info
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Gradle 빌드 옵션
|
||||||
|
```bash
|
||||||
|
# Weblogic 배포용 (테스트 제외)
|
||||||
|
gradle build -x test -Pprofile=weblogic
|
||||||
|
```
|
||||||
|
|
||||||
|
- -Pprofile=weblogic 사용시 weblogic-web.xml 을 web.xml 로 사용 (DefaultServlet 이슈)
|
||||||
@@ -1,10 +1,13 @@
|
|||||||
package com.eactive.eai.rms.data.config;
|
package com.eactive.eai.rms.data.config;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import javax.persistence.EntityManagerFactory;
|
import javax.persistence.EntityManagerFactory;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
|
import org.hibernate.cfg.AvailableSettings;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.ComponentScan.Filter;
|
import org.springframework.context.annotation.ComponentScan.Filter;
|
||||||
@@ -13,10 +16,12 @@ import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
|
|||||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||||
import org.springframework.orm.jpa.JpaTransactionManager;
|
import org.springframework.orm.jpa.JpaTransactionManager;
|
||||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||||
|
import org.springframework.orm.jpa.support.SharedEntityManagerBean;
|
||||||
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
|
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
|
||||||
import org.springframework.transaction.TransactionManager;
|
import org.springframework.transaction.TransactionManager;
|
||||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||||
|
|
||||||
|
import com.eactive.eai.common.dao.Keys;
|
||||||
import com.eactive.eai.data.jpa.BaseRepositoryImpl;
|
import com.eactive.eai.data.jpa.BaseRepositoryImpl;
|
||||||
import com.eactive.eai.rms.common.datasource.DataSourceTypeManager;
|
import com.eactive.eai.rms.common.datasource.DataSourceTypeManager;
|
||||||
import com.eactive.eai.rms.data.EMSDataSource;
|
import com.eactive.eai.rms.data.EMSDataSource;
|
||||||
@@ -36,8 +41,12 @@ public class EMSTenantConfiguration {
|
|||||||
bean.setDataSource(dataSource);
|
bean.setDataSource(dataSource);
|
||||||
bean.setPackagesToScan("com.eactive.eai.data", "com.eactive.eai.rms.data", "com.eactive.apim.portal");
|
bean.setPackagesToScan("com.eactive.eai.data", "com.eactive.eai.rms.data", "com.eactive.apim.portal");
|
||||||
bean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
|
bean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
|
||||||
|
|
||||||
bean.setJpaProperties(hibernateProperties);
|
bean.setJpaProperties(hibernateProperties);
|
||||||
|
|
||||||
|
Map<String, Object> settings = new HashMap<>();
|
||||||
|
settings.put(AvailableSettings.DEFAULT_SCHEMA, System.getProperty(Keys.TABLE_OWNER_KEY));
|
||||||
|
bean.setJpaPropertyMap(settings);
|
||||||
|
|
||||||
return bean;
|
return bean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,4 +59,11 @@ public class EMSTenantConfiguration {
|
|||||||
return jpaTransactionManager;
|
return jpaTransactionManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean("entityManagerForEMS")
|
||||||
|
public SharedEntityManagerBean entityManager(@Qualifier("entityManagerFactoryForEMS") EntityManagerFactory entityManagerFactory) {
|
||||||
|
SharedEntityManagerBean sharedEntityManagerBean = new SharedEntityManagerBean();
|
||||||
|
sharedEntityManagerBean.setEntityManagerFactory(entityManagerFactory);
|
||||||
|
return sharedEntityManagerBean;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user