Announcement Announcement Module
No announcement yet.
Multi-Package Configuration Problem Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multi-Package Configuration Problem

    I am working on an application with multiple Spring enabled libraries and packages. I run into many problems due to the multi-configurations in those packages. One outstanding issue is the DB transaction management. In the web application, I have the following MyBatis configuration
    <import resource="classpath:spring/app1-config.xml" /> 
    <import resource="classpath:spring/app2-config.xml" /> 
    <bean id="accountMapper" class="org.mybatis.spring.mapper.MapperFactoryBean"
    		p:sqlSessionFactory-ref="sqlSessionFactory" />
    and the sqlSessionFactory is used in the same one within another configuration file which is one of appX-config.xml files.

    With the above configuration, the transaction management is off and the app can't perform a DB write operation. I will run into at least one start-up error if I add datasource, sqlSessionFactory, and transaction in this configuration even with different bean names to avoid bean name collisions.

    What is a right approach to solve this problem?