Work on java config
This commit is contained in:
parent
e1eed8ce5e
commit
febb15b78e
|
@ -0,0 +1,43 @@
|
|||
package ca.uhn.fhir.jpa.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
|
||||
@Configuration
|
||||
public class BaseConfig {
|
||||
|
||||
private static FhirContext ourFhirContextDstu2;
|
||||
private static FhirContext ourFhirContextDstu1;
|
||||
private static FhirContext ourFhirContextDstu2Hl7Org;
|
||||
|
||||
@Bean(name="myFhirContextDstu2")
|
||||
@Lazy
|
||||
public FhirContext fhirContextDstu2() {
|
||||
if (ourFhirContextDstu2 == null) {
|
||||
ourFhirContextDstu2 = FhirContext.forDstu2();
|
||||
}
|
||||
return ourFhirContextDstu2;
|
||||
}
|
||||
|
||||
@Bean(name="myFhirContextDstu1")
|
||||
@Lazy
|
||||
public FhirContext fhirContextDstu1() {
|
||||
if (ourFhirContextDstu1 == null) {
|
||||
ourFhirContextDstu1 = FhirContext.forDstu1();
|
||||
}
|
||||
return ourFhirContextDstu1;
|
||||
}
|
||||
|
||||
@Bean(name="myFhirContextDstu2Hl7Org")
|
||||
@Lazy
|
||||
public FhirContext fhirContextDstu2Hl7Org() {
|
||||
if (ourFhirContextDstu2Hl7Org == null) {
|
||||
ourFhirContextDstu2Hl7Org = FhirContext.forDstu2Hl7Org();
|
||||
}
|
||||
return ourFhirContextDstu2Hl7Org;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package ca.uhn.fhir.jpa.config;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowire;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
|
||||
@Configuration
|
||||
public class BaseDstu1Config extends BaseConfig {
|
||||
|
||||
@Bean(name = "mySystemDaoDstu1", autowire = Autowire.BY_NAME)
|
||||
public ca.uhn.fhir.jpa.dao.IFhirSystemDao<List<IResource>> fhirSystemDaoDstu1() {
|
||||
ca.uhn.fhir.jpa.dao.FhirSystemDaoDstu1 retVal = new ca.uhn.fhir.jpa.dao.FhirSystemDaoDstu1();
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@Bean(name = "mySystemProviderDstu1")
|
||||
public ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu1 systemDaoDstu1() {
|
||||
ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu1 retVal = new ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu1();
|
||||
retVal.setDao(fhirSystemDaoDstu1());
|
||||
return retVal;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package ca.uhn.fhir.jpa.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowire;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
import org.springframework.web.socket.WebSocketHandler;
|
||||
import org.springframework.web.socket.config.annotation.EnableWebSocket;
|
||||
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
|
||||
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
|
||||
import org.springframework.web.socket.handler.PerConnectionWebSocketHandler;
|
||||
|
||||
import ca.uhn.fhir.jpa.dao.FhirSearchDao;
|
||||
import ca.uhn.fhir.jpa.dao.IFhirSystemDao;
|
||||
import ca.uhn.fhir.jpa.dao.ISearchDao;
|
||||
import ca.uhn.fhir.jpa.subscription.SubscriptionWebsocketHandler;
|
||||
|
||||
@Configuration
|
||||
@EnableTransactionManagement
|
||||
@EnableWebSocket()
|
||||
@EnableScheduling
|
||||
public class BaseDstu2Config extends BaseConfig implements WebSocketConfigurer {
|
||||
|
||||
@Bean(name = "mySystemDaoDstu2", autowire = Autowire.BY_NAME)
|
||||
public IFhirSystemDao<ca.uhn.fhir.model.dstu2.resource.Bundle> fhirSystemDaoDstu2() {
|
||||
ca.uhn.fhir.jpa.dao.FhirSystemDaoDstu2 retVal = new ca.uhn.fhir.jpa.dao.FhirSystemDaoDstu2();
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@Bean(name = "mySystemProviderDstu2")
|
||||
public ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu2 systemDaoDstu2() {
|
||||
ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu2 retVal = new ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu2();
|
||||
retVal.setDao(fhirSystemDaoDstu2());
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@Bean(name = "myJpaValidationSupportDstu2", autowire = Autowire.BY_NAME)
|
||||
public ca.uhn.fhir.jpa.dao.IJpaValidationSupport jpaValidationSupportDstu2() {
|
||||
ca.uhn.fhir.jpa.dao.JpaValidationSupportDstu2 retVal = new ca.uhn.fhir.jpa.dao.JpaValidationSupportDstu2();
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
|
||||
registry.addHandler(subscriptionWebSocketHandler(), "/websocket/dstu2").withSockJS();
|
||||
}
|
||||
|
||||
@Bean(autowire = Autowire.BY_TYPE)
|
||||
public WebSocketHandler subscriptionWebSocketHandler() {
|
||||
return new PerConnectionWebSocketHandler(SubscriptionWebsocketHandler.class);
|
||||
}
|
||||
|
||||
@Bean(autowire = Autowire.BY_TYPE)
|
||||
public ISearchDao searchDao() {
|
||||
return new FhirSearchDao();
|
||||
}
|
||||
|
||||
// <!--
|
||||
// <bean id="mySubscriptionWebsocketHandler" class="org.springframework.web.socket.handler.PerConnectionWebSocketHandler">
|
||||
// <constructor-arg value="ca.uhn.fhir.jpa.subscription.SubscriptionWebsocketHandler"/>
|
||||
// </bean>
|
||||
//
|
||||
// <bean id="mySubscriptionSecurityInterceptor" class="ca.uhn.fhir.jpa.util.SubscriptionsRequireManualActivationInterceptor"/>
|
||||
// -->
|
||||
|
||||
}
|
|
@ -1,20 +1,16 @@
|
|||
package ca.uhn.fhir.jpa.config;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.commons.dbcp2.BasicDataSource;
|
||||
import org.hibernate.dialect.DerbyTenSevenDialect;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.hibernate.jpa.HibernatePersistenceProvider;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.orm.jpa.JpaTransactionManager;
|
||||
import org.springframework.orm.jpa.JpaVendorAdapter;
|
||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||
import org.springframework.orm.jpa.vendor.Database;
|
||||
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
import ca.uhn.fhir.jpa.dao.DaoConfig;
|
||||
|
@ -24,14 +20,13 @@ import ca.uhn.fhir.jpa.rp.dstu.BaseJavaConfigDstu1;
|
|||
@EnableTransactionManagement()
|
||||
public class TestDstu1Config extends BaseJavaConfigDstu1 {
|
||||
|
||||
@Override
|
||||
@Bean(name="myDaoConfigDstu1")
|
||||
public DaoConfig daoConfigDstu1() {
|
||||
@Bean()
|
||||
public DaoConfig daoConfig() {
|
||||
return new DaoConfig();
|
||||
}
|
||||
|
||||
@Bean(name="myPersistenceDataSourceDstu1")
|
||||
public DataSource dataSourceDstu1() {
|
||||
@Bean()
|
||||
public DataSource dataSource() {
|
||||
BasicDataSource retVal = new BasicDataSource();
|
||||
retVal.setDriver(new org.apache.derby.jdbc.EmbeddedDriver());
|
||||
retVal.setUrl("jdbc:derby:memory:myUnitTestDB;create=true");
|
||||
|
@ -40,36 +35,31 @@ public class TestDstu1Config extends BaseJavaConfigDstu1 {
|
|||
return retVal;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Bean(name="myTransactionManagerDstu1")
|
||||
public JpaTransactionManager platformTransactionManagerDstu1() {
|
||||
@Bean()
|
||||
public JpaTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) {
|
||||
JpaTransactionManager retVal = new JpaTransactionManager();
|
||||
retVal.setEntityManagerFactory(entityManagerFactoryDstu1());
|
||||
retVal.afterPropertiesSet();
|
||||
retVal.setEntityManagerFactory(entityManagerFactory);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public EntityManagerFactory entityManagerFactoryDstu1() {
|
||||
@Bean()
|
||||
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
|
||||
LocalContainerEntityManagerFactoryBean retVal = new LocalContainerEntityManagerFactoryBean();
|
||||
retVal.setDataSource(dataSourceDstu1());
|
||||
retVal.setPersistenceUnitName("PU_HapiFhirJpaDstu1");
|
||||
retVal.setDataSource(dataSource());
|
||||
retVal.setPackagesToScan("ca.uhn.fhir.jpa.entity");
|
||||
retVal.setJpaVendorAdapter(jpaVendorAdapter());
|
||||
retVal.setPersistenceProvider(new HibernatePersistenceProvider());
|
||||
retVal.setJpaProperties(jpaProperties());
|
||||
retVal.afterPropertiesSet();
|
||||
return retVal.getNativeEntityManagerFactory();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public JpaVendorAdapter jpaVendorAdapter() {
|
||||
HibernateJpaVendorAdapter retVal = new HibernateJpaVendorAdapter();
|
||||
retVal.setGenerateDdl(true);
|
||||
retVal.setDatabasePlatform(DerbyTenSevenDialect.class.getName());
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EntityManager entityManagerDstu1() {
|
||||
return entityManagerFactoryDstu1().createEntityManager();
|
||||
private Properties jpaProperties() {
|
||||
Properties extraProperties = new Properties();
|
||||
extraProperties.put("hibernate.format_sql", "true");
|
||||
extraProperties.put("hibernate.show_sql", "false");
|
||||
extraProperties.put("hibernate.hbm2ddl.auto", "update");
|
||||
return extraProperties;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -20,13 +20,13 @@ import ca.uhn.fhir.jpa.rp.dstu2.BaseJavaConfigDstu2;
|
|||
@EnableTransactionManagement()
|
||||
public class TestDstu2Config extends BaseJavaConfigDstu2 {
|
||||
|
||||
@Bean(name="myDaoConfigDstu2")
|
||||
public DaoConfig daoConfigDstu2() {
|
||||
@Bean()
|
||||
public DaoConfig daoConfig() {
|
||||
return new DaoConfig();
|
||||
}
|
||||
|
||||
@Bean(name="myPersistenceDataSourceDstu2")
|
||||
public DataSource dataSourceDstu2() {
|
||||
@Bean()
|
||||
public DataSource dataSource() {
|
||||
BasicDataSource retVal = new BasicDataSource();
|
||||
retVal.setDriver(new org.apache.derby.jdbc.EmbeddedDriver());
|
||||
retVal.setUrl("jdbc:derby:memory:myUnitTestDB;create=true");
|
||||
|
@ -43,10 +43,10 @@ public class TestDstu2Config extends BaseJavaConfigDstu2 {
|
|||
}
|
||||
|
||||
@Bean()
|
||||
public LocalContainerEntityManagerFactoryBean entityManagerFactoryDstu2() {
|
||||
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
|
||||
LocalContainerEntityManagerFactoryBean retVal = new LocalContainerEntityManagerFactoryBean();
|
||||
retVal.setPersistenceUnitName("PU_HapiFhirJpaDstu2");
|
||||
retVal.setDataSource(dataSourceDstu2());
|
||||
retVal.setDataSource(dataSource());
|
||||
retVal.setPackagesToScan("ca.uhn.fhir.jpa.entity");
|
||||
retVal.setPersistenceProvider(new HibernatePersistenceProvider());
|
||||
retVal.setJpaProperties(jpaProperties());
|
||||
|
@ -54,12 +54,12 @@ public class TestDstu2Config extends BaseJavaConfigDstu2 {
|
|||
return retVal;
|
||||
}
|
||||
|
||||
private Properties jpaProperties() {
|
||||
Properties extraProperties = new Properties();
|
||||
extraProperties.put("hibernate.format_sql", "true");
|
||||
extraProperties.put("hibernate.show_sql", "false");
|
||||
extraProperties.put("hibernate.hbm2ddl.auto", "update");
|
||||
return extraProperties;
|
||||
}
|
||||
private Properties jpaProperties() {
|
||||
Properties extraProperties = new Properties();
|
||||
extraProperties.put("hibernate.format_sql", "true");
|
||||
extraProperties.put("hibernate.show_sql", "false");
|
||||
extraProperties.put("hibernate.hbm2ddl.auto", "update");
|
||||
return extraProperties;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,9 +13,11 @@ import org.hl7.fhir.instance.model.api.IIdType;
|
|||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.jpa.config.TestDstu2Config;
|
||||
import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt;
|
||||
import ca.uhn.fhir.model.dstu.resource.Device;
|
||||
import ca.uhn.fhir.model.dstu.resource.DiagnosticReport;
|
||||
|
@ -34,7 +36,7 @@ import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
|
|||
@SuppressWarnings("unused")
|
||||
public class FhirResourceDaoDstu1Test extends BaseJpaTest {
|
||||
|
||||
private static ClassPathXmlApplicationContext ourCtx;
|
||||
private static AnnotationConfigApplicationContext ourCtx;
|
||||
private static IFhirResourceDao<Device> ourDeviceDao;
|
||||
private static IFhirResourceDao<DiagnosticReport> ourDiagnosticReportDao;
|
||||
private static IFhirResourceDao<Encounter> ourEncounterDao;
|
||||
|
@ -135,7 +137,7 @@ public class FhirResourceDaoDstu1Test extends BaseJpaTest {
|
|||
@SuppressWarnings("unchecked")
|
||||
@BeforeClass
|
||||
public static void beforeClass() {
|
||||
ourCtx = new ClassPathXmlApplicationContext("hapi-fhir-server-resourceproviders-dstu1.xml", "fhir-jpabase-spring-test-config.xml");
|
||||
ourCtx = new AnnotationConfigApplicationContext(TestDstu2Config.class);
|
||||
ourPatientDao = ourCtx.getBean("myPatientDaoDstu1", IFhirResourceDao.class);
|
||||
ourObservationDao = ourCtx.getBean("myObservationDaoDstu1", IFhirResourceDao.class);
|
||||
ourDiagnosticReportDao = ourCtx.getBean("myDiagnosticReportDaoDstu1", IFhirResourceDao.class);
|
||||
|
|
|
@ -22,7 +22,6 @@ import ca.uhn.fhir.model.primitive.StringDt;
|
|||
import ca.uhn.fhir.rest.param.StringParam;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
|
||||
@ContextConfiguration(locations = { "classpath:fhir-spring-search-config-dstu2.xml" })
|
||||
public class FhirResourceDaoDstu2SearchFtTest extends BaseJpaDstu2Test {
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirResourceDaoDstu2SearchFtTest.class);
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ import ca.uhn.fhir.rest.param.StringOrListParam;
|
|||
import ca.uhn.fhir.rest.param.StringParam;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
|
||||
@ContextConfiguration(locations = { "classpath:fhir-spring-search-config-dstu2.xml" })
|
||||
public class FhirSearchDaoDstu2Test extends BaseJpaDstu2Test {
|
||||
|
||||
@Autowired
|
||||
|
|
|
@ -23,9 +23,11 @@ import org.hl7.fhir.instance.model.api.IIdType;
|
|||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.jpa.config.TestDstu1Config;
|
||||
import ca.uhn.fhir.jpa.entity.TagTypeEnum;
|
||||
import ca.uhn.fhir.model.api.Bundle;
|
||||
import ca.uhn.fhir.model.api.BundleEntry;
|
||||
|
@ -45,7 +47,7 @@ import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
|||
|
||||
public class FhirSystemDaoDstu1Test extends BaseJpaTest {
|
||||
|
||||
private static ClassPathXmlApplicationContext ourCtx;
|
||||
private static AnnotationConfigApplicationContext ourCtx;
|
||||
private static FhirContext ourFhirContext;
|
||||
private static IFhirResourceDao<Location> ourLocationDao;
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirSystemDaoDstu1Test.class);
|
||||
|
@ -466,8 +468,8 @@ public class FhirSystemDaoDstu1Test extends BaseJpaTest {
|
|||
@SuppressWarnings("unchecked")
|
||||
@BeforeClass
|
||||
public static void beforeClass() {
|
||||
ourCtx = new ClassPathXmlApplicationContext("hapi-fhir-server-resourceproviders-dstu1.xml", "fhir-jpabase-spring-test-config.xml");
|
||||
ourFhirContext = ourCtx.getBean(FhirContext.class);
|
||||
ourCtx = new AnnotationConfigApplicationContext(TestDstu1Config.class);
|
||||
ourFhirContext = ourCtx.getBean("myFhirContextDstu1", FhirContext.class);
|
||||
ourPatientDao = ourCtx.getBean("myPatientDaoDstu1", IFhirResourceDao.class);
|
||||
ourObservationDao = ourCtx.getBean("myObservationDaoDstu1", IFhirResourceDao.class);
|
||||
ourLocationDao = ourCtx.getBean("myLocationDaoDstu1", IFhirResourceDao.class);
|
||||
|
|
|
@ -28,87 +28,21 @@ import ca.uhn.fhir.jpa.dao.IFhirSystemDao;
|
|||
@Configuration
|
||||
@EnableScheduling()
|
||||
#if ( ${versionCapitalized} == 'Dstu2' )
|
||||
@EnableJpaRepositories(basePackages="ca.uhn.fhir.jpa.dao.data", entityManagerFactoryRef="entityManagerFactoryDstu2", transactionManagerRef="transactionManagerDstu2")
|
||||
#end
|
||||
public abstract class BaseJavaConfig${versionCapitalized} implements SchedulingConfigurer {
|
||||
|
||||
private static FhirContext ourFhirContextDstu2;
|
||||
private static FhirContext ourFhirContextDstu1;
|
||||
private static FhirContext ourFhirContextDstu2Hl7Org;
|
||||
|
||||
@Bean(name="myFhirContextDstu2")
|
||||
@Lazy
|
||||
public FhirContext fhirContextDstu2() {
|
||||
if (ourFhirContextDstu2 == null) {
|
||||
ourFhirContextDstu2 = FhirContext.forDstu2();
|
||||
}
|
||||
return ourFhirContextDstu2;
|
||||
}
|
||||
|
||||
@Bean(name="myFhirContextDstu1")
|
||||
@Lazy
|
||||
public FhirContext fhirContextDstu1() {
|
||||
if (ourFhirContextDstu1 == null) {
|
||||
ourFhirContextDstu1 = FhirContext.forDstu1();
|
||||
}
|
||||
return ourFhirContextDstu1;
|
||||
}
|
||||
|
||||
@Bean(name="myFhirContextDstu2Hl7Org")
|
||||
@Lazy
|
||||
public FhirContext fhirContextDstu2Hl7Org() {
|
||||
if (ourFhirContextDstu2Hl7Org == null) {
|
||||
ourFhirContextDstu2Hl7Org = FhirContext.forDstu2Hl7Org();
|
||||
}
|
||||
return ourFhirContextDstu2Hl7Org;
|
||||
}
|
||||
|
||||
#if ( ${versionCapitalized} == 'Dstu1' )
|
||||
@Bean(name="mySystemDaoDstu1", autowire=Autowire.BY_NAME)
|
||||
public ca.uhn.fhir.jpa.dao.IFhirSystemDao<List<IResource>> fhirSystemDaoDstu1() {
|
||||
ca.uhn.fhir.jpa.dao.FhirSystemDaoDstu1 retVal = new ca.uhn.fhir.jpa.dao.FhirSystemDaoDstu1();
|
||||
return retVal;
|
||||
}
|
||||
@Bean(name="mySystemProviderDstu1")
|
||||
public ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu1 systemDaoDstu1() {
|
||||
ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu1 retVal = new ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu1();
|
||||
retVal.setDao(fhirSystemDaoDstu1());
|
||||
return retVal;
|
||||
}
|
||||
#end
|
||||
#if ( ${versionCapitalized} == 'Dstu2' )
|
||||
@Bean(name="mySystemDaoDstu2")
|
||||
public IFhirSystemDao<ca.uhn.fhir.model.dstu2.resource.Bundle> fhirSystemDao${versionCapitalized}() {
|
||||
ca.uhn.fhir.jpa.dao.FhirSystemDaoDstu2 retVal = new ca.uhn.fhir.jpa.dao.FhirSystemDaoDstu2();
|
||||
applyDaoConfiguration(retVal);
|
||||
return retVal;
|
||||
}
|
||||
@Bean(name="mySystemProviderDstu2")
|
||||
public ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu2 systemDaoDstu2() {
|
||||
ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu2 retVal = new ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu2();
|
||||
retVal.setDao(fhirSystemDaoDstu2());
|
||||
return retVal;
|
||||
}
|
||||
@EnableJpaRepositories(basePackages="ca.uhn.fhir.jpa.dao.data")
|
||||
#end
|
||||
public abstract class BaseJavaConfig${versionCapitalized} extends ca.uhn.fhir.jpa.config.Base${versionCapitalized}Config implements SchedulingConfigurer {
|
||||
|
||||
@Bean(destroyMethod="shutdown")
|
||||
public Executor taskScheduler() {
|
||||
return Executors.newScheduledThreadPool(5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
|
||||
taskRegistrar.setScheduler(taskScheduler());
|
||||
}
|
||||
|
||||
|
||||
#if ( ${versionCapitalized} == 'Dstu2' )
|
||||
@Bean(name="myJpaValidationSupportDstu2", autowire=Autowire.BY_NAME)
|
||||
public ca.uhn.fhir.jpa.dao.IJpaValidationSupport jpaValidationSupportDstu2() {
|
||||
ca.uhn.fhir.jpa.dao.JpaValidationSupportDstu2 retVal = new ca.uhn.fhir.jpa.dao.JpaValidationSupportDstu2();
|
||||
return retVal;
|
||||
}
|
||||
#end
|
||||
|
||||
@Bean(name="myResourceProviders${versionCapitalized}")
|
||||
public List<IResourceProvider> resourceProviders${versionCapitalized}() {
|
||||
List<IResourceProvider> retVal = new ArrayList<IResourceProvider>();
|
||||
|
|
Loading…
Reference in New Issue