maven构建多模块SSH项目配置文件的问题

1、使用maven做为项目构建工具,创建studio、common、oa、system四个模块项目,其中studio为父模块,common为数据库操作模块、Oa 和system为业务模块。common 配置了spring 集成hibernate的基本配置文件common-spring.xml。现在需要在oa模块中建立一个实体类user和user.hbm.xml,请问oa中的oa_spring如何配置,common中如何读取user.hbm.xml?

我的common_spring.xml内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="
     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
     http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
     http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
     http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd"
    default-autowire="byName">
    <!-- enable component scanning (beware that this does not enable mapper
        scanning!) -->
    <context:component-scan base-package="com.huadainfo.com.dao" />
    <context:component-scan base-package="com.huadainfo.com.dao.impl" />
    <bean
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations" value="classpath:datasource.properties" />
    </bean>

    <!-- 数据源配置 -->
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
        destroy-method="close">
        <property name="driverClassName" value="${jdbc.driverClassName}"></property>
        <property name="url" value="${jdbc.url}"></property>
        <property name="username" value="${jdbc.username}"></property>
        <property name="password" value="${jdbc.password}"></property>
        <property name="initialSize" value="10"></property>
        <property name="maxActive" value="1000"></property>
        <property name="maxIdle" value="300"></property>
        <property name="minIdle" value="10"></property>
        <property name="maxWait" value="10000"></property>
        <property name="removeAbandoned" value="true" />
        <property name="removeAbandonedTimeout" value="60"/>
        <property name="logAbandoned" value="true" />
        <property name="testOnBorrow" value="true"/>
           <property name="testWhileIdle" value="true"/>
           <property name="validationQuery" value="select getdate()"/>
    </bean>

    <bean id="sessionFactory"
        class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="hibernateProperties">
            <props>
                <!-- 指定Hibernate的连接方言 -->
                <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
                <!-- 配置启动应用时,是否根据Hibernate映射自动创建数据表 -->
                <prop key="hibernate.show_sql">true</prop>
                <prop key="hibernate.format_sql">true</prop>
                <prop key="hibernate.current_session_context_class">org.springframework.orm.hibernate4.SpringSessionContext
                </prop>
                <prop key="hibernate.cache.provider_class">net.sf.ehcache.hibernate.EhCacheProvider</prop>
                <prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory
                </prop>
            </props>
           
        </property>
        <property name="mappingResources">
            <list>
                <value>classpath*:com/huadainfo/entity/*.hbm.xml</value>
            </list>
        </property>这部分该怎么写
       
    </bean>
        <!-- A transaction manager for working with Hibernate SessionFactories -->
    <bean id="transactionManager"
        class="org.springframework.orm.hibernate4.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>
    <!-- 配置事务的传播特性 -->
    <tx:advice id="txAdvice" transaction-manager="transactionManager">
        <tx:attributes>
            <tx:method name="add*" propagation="REQUIRED" read-only="false" />
            <tx:method name="delete*" propagation="REQUIRED" read-only="false" />
            <tx:method name="update*" propagation="REQUIRED" read-only="false" />
            <tx:method name="save*" propagation="REQUIRED" read-only="false" />
            <tx:method name="*" read-only="true" />
        </tx:attributes>
    </tx:advice>
    <!-- 那些类的哪些方法参与事务 -->
    <aop:config>
        <aop:pointcut id="allManagerMethod"
            expression="execution(public * com.huadainfo.common.dao.impl.*.*(..))" />
        <aop:advisor pointcut-ref="allManagerMethod" advice-ref="txAdvice" />
    </aop:config>
    <context:component-scan base-package="com.huadainfo.common.dao" />
    <context:component-scan base-package="com.huadainfo.common.dao.impl" />
    <bean id="hiberDao" class="com.huadainfo.common.dao.impl.HibernateDaoImpl">
        <property name="sessionFactory" ref="sessionFactory"></property>
    </bean>
</beans>

oa_spring.xml的内容<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="
     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
     http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
     http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
     http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
    <!-- enable component scanning (beware that this does not enable mapper
        scanning!) -->
    <import resource="classpath*:common_spring.xml"/>(引入不到文件)
    <bean id="tset" class="com.huadainfo.oa.service.impl.TestNameimpl">
        <property name="hiberDao" ref="hiberDao"></property>
    </bean>
    
</beans>

 

studio、common、oa、system
那么除了studio其他都是jar.只要是包名路径对了
像spring,hib配置文件爱都全路径,形式

你的系统是 oa system 依赖common ,在oa 和 system 模块 需要通过 dependency 依赖common。加了吗

1.确保 有引用关系
对,还要在pom.xml中引用其他jar

commons
commons
1.4

2.确保配置文件路径