mybatise配置文件通配

ApplicationContext context = new

ClassPathXmlApplicationContext("classpath*:conf/**/*application-context.xml");来创建ApplicationContext对象的话,Spring首先会通过路径中的非通配符部分即conf,先确定conf的路径,由于使用了classpaht*前缀,因此bin目录下的conf和jar包里的conf都会被加载,同时由于使用了/**/的方式,表明要加载conf目录下包括各级子目录中的所有配置文件,因此bin/conf/application-context.xml和

<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">

<property name="basePackage" value="com/wondersgroup/employeeBenefits/core/bases/model/*/dao" />

这个代表模糊某级目录
web-inf/无论浏览器还是内部只能用跳转,spring mvc中配置解析可以配置这里


======================================================================
<!-- myBatis文件 -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<!-- 自动扫描entity目录, 省掉Configuration.xml里的手工配置 -->
<property name="mapperLocations"  >
<array>
                <value> classpath:com/wondersgroup/employeeBenefits/core/bases/mapping/*.xml</value>//配合使用dao的配置
                <value> classpath:com/wondersgroup/employeeBenefits/core/author/mapping/*.xml</value>
            </array>
</property>
      <property name="mapperLocations"  >
<array>
                <value> classpath:com/wondersgroup/employeeBenefits/core/**/*.xml</value>等效
            </array>
</property>
        <property name="plugins">
            <array>
                <bean class="com.github.pagehelper.PageHelper">
                    <property name="properties">
                        <value>
                            dialect=mysql
                            reasonable=true
                        </value>
                    </property>
                </bean>
                <bean class="com.github.abel533.mapperhelper.MapperInterceptor">
                    <property name="properties">
                        <value>
                            mappers=com.github.abel533.mapper.Mapper
                            IDENTITY=mysql
                            notEmpty=true
                        </value>
                    </property>
                </bean>
            </array>
        </property>
</bean>

<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com/wondersgroup/employeeBenefits/core/*/dao" />//配合使用xml的配置

<!-- com/wondersgroup/benefit/cloud/model/core/mapper/dao -->
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
</bean>



=====================================================================

你可能感兴趣的:(mybatis,配置中的通配)