멀티태넌스 동작 확인
This commit is contained in:
@@ -113,13 +113,5 @@
|
||||
<prop key="hibernate.bytecode.use_reflection_optimizer">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>
|
||||
</beans>
|
||||
+9
-10
@@ -47,20 +47,19 @@ compileJava {
|
||||
}
|
||||
|
||||
war {
|
||||
def profile = project.findProperty("profile") ?: "weblogic"
|
||||
|
||||
if (profile == "weblogic") {
|
||||
webXml = file("WebContent/WEB-INF/weblogic-web.xml")
|
||||
} else {
|
||||
webXml = file("WebContent/WEB-INF/web.xml")
|
||||
}
|
||||
|
||||
|
||||
def profile = project.findProperty("profile") ?: "tomcat"
|
||||
|
||||
if (profile == "weblogic") {
|
||||
webXml = file("WebContent/WEB-INF/weblogic-web.xml")
|
||||
}
|
||||
|
||||
|
||||
// rootSpec.exclude '**/persistence.xml'
|
||||
exclude '**/context.xml'
|
||||
archiveFileName = "eapim-admin.war"
|
||||
archiveFileName = "eapim-admin.war"
|
||||
}
|
||||
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
||||
|
||||
@@ -46,3 +46,11 @@ eLink 모듈을 참조하여 구성되어있으며, 추후 필요 모듈외에
|
||||
-Dfile.encoding=utf-8
|
||||
-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;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.hibernate.cfg.AvailableSettings;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
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.orm.jpa.JpaTransactionManager;
|
||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||
import org.springframework.orm.jpa.support.SharedEntityManagerBean;
|
||||
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
|
||||
import org.springframework.transaction.TransactionManager;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
import com.eactive.eai.common.dao.Keys;
|
||||
import com.eactive.eai.data.jpa.BaseRepositoryImpl;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceTypeManager;
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
@@ -31,13 +36,17 @@ public class EMSTenantConfiguration {
|
||||
public LocalContainerEntityManagerFactoryBean entityManagerFactoryForEMS(
|
||||
@Qualifier(DataSourceTypeManager.MONITORING) DataSource dataSource,
|
||||
@Qualifier("hibernateProperties") Properties hibernateProperties) {
|
||||
|
||||
|
||||
LocalContainerEntityManagerFactoryBean bean = new LocalContainerEntityManagerFactoryBean();
|
||||
bean.setDataSource(dataSource);
|
||||
bean.setPackagesToScan("com.eactive.eai.data", "com.eactive.eai.rms.data", "com.eactive.apim.portal");
|
||||
bean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -49,5 +58,12 @@ public class EMSTenantConfiguration {
|
||||
jpaTransactionManager.setEntityManagerFactory(entityManagerFactory);
|
||||
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