mybatise configuration file wildcard

ApplicationContext context = new

ClassPathXmlApplicationContext("classpath*:conf/**/*application-context.xml"); To create an ApplicationContext object, Spring will first pass the non-wildcard part in the path, namely conf, and first determine the path of conf, because The classpaht* prefix is ​​used, so the conf in the bin directory and the conf in the jar package will be loaded. At the same time, because the /**/ method is used, it indicates that all configuration files in the conf directory, including subdirectories at all levels, are to be loaded. So bin/conf/application-context.xml and

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

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

This represents a blurred level of directory
web-inf/ no matter the browser or the internal can only be used to jump, the configuration analysis in spring mvc can be configured here


================ ===================================================== ====
<!-- myBatis file-->
<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>



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

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326815744&siteId=291194637