Hi,
supposed that, in the normal xml configuration file, i have:
As you can see, DAO1's configuration inherit from templateHibernateDAO.Code:<bean id="hibernateSessionFactory" class=".....LocalSessionFactoryBean" lazy-init="true"> <property name="mappingResources"> <ref bean="somelist" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${jdbc.dialect}</prop> <prop key="hibernate.show_sql">${hibernate.show_sql}</prop> <prop key="hibernate.default_schema" >${jdbc.schema}</prop> <prop key="hibernate.jdbc.batch_size" >20</prop> <prop key="hibernate.cache.use_second_level_cache" >${hibernate.cache.use_second_level_cache}</prop> <prop key="hibernate.cache.provider_class">${hibernate.cache.provider_class}</prop> <prop key="hibernate.cache.use_query_cache" >${hibernate.cache.use_query_cache}</prop> <prop key="hibernate.cache.provider_configuration_file_resource_path=">ehcache.xml</prop> <!-- prop key="hibernate.hbm2ddl.auto">create-drop</prop --> </props> </property> <property name="dataSource"> <ref bean="${data.source}" /> </property> <property name="lobHandler"> <bean class="org.springframework.jdbc.support.lob.OracleLobHandler" /> </property> <property name="entityInterceptor"><ref local="hibernateEntityInterceptor" /></property> <property name="interceptorFilter" ref="interceptorFilter" /> </bean> <bean id="templateHibernateDAO" lazy-init="true"> <property name="sessionFactory"> <ref local="hibernateSessionFactory" /> </property> <property name="maxResults" value="1000"/> </bean> ... <bean id="DAO1" class="..." parent="templateHibernateDAO"> </bean>
however, i would like to configure all the beans above by javaconfig. here is my configuration
my problem:Code:@Configurable @PropertiesValueSource(locations = "classpath:db/environment.properties") public abstract class AppCoreConfig { @Bean public LocalSessionFactoryBean hibernateSessionFactory(){ LocalSessionFactoryBean localSessionFactoryBean = new LocalSessionFactoryBean(); localSessionFactoryBean.setMappingResources(getMappingResources()); localSessionFactoryBean.setHibernateProperties(getHibernateProperties()); localSessionFactoryBean.setDataSource(getBasicDataSource()); localSessionFactoryBean.setLobHandler(new OracleLobHandler()); //TODO: if we want to put an ADVICE, should put here return localSessionFactoryBean; } } ...
in java configuration, i cant create a bean similar to the bean "templateHibernateDAO" in normal xml config. i find out that javaConfig does not support configuration inheritance. is there any way to support the config inheritance in javaConfig?
please help me, thanks in advance


