mybatis / mybatis-3

MyBatis SQL mapper framework for Java
http://mybatis.github.io/mybatis-3/
Apache License 2.0
19.74k stars 12.84k forks source link

Support package scanning using wildcard #886

Open Dreampie opened 7 years ago

Dreampie commented 7 years ago

https://github.com/mybatis/spring-boot-starter/issues/131

successed:

mybatis:
    type-handlers-package: com.meituan.funds.common.handlers

failed:

mybatis:
    type-handlers-package: com.meituan.funds.**.handlers
kazuki43zoo commented 7 years ago

Hi @Dreampie

Is this feature request ? If this is feature request, please describe a request detail and use case, etc .. If this is question, Please post your question to the mailing list. We use GitHub Issues only to track bugs and feature requests.

Thanks.

Dreampie commented 7 years ago

yes,it is maybe feature request or question,but I can not access google group,now

jasonleaster commented 7 years ago

@Dreampie I'm not very sure about the context of your problem, but why not try to use mybatis-spring scanner ?

   <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <property name="basePackage" value="org.jasonleaster.**.dao" />
        <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
    </bean>

MapperScannerConfigurer works well in my project. I have different mapper interface in different package in my project.

BigSully commented 3 years ago

@MapperScan support wildcard value, the below code works for me.

@MapperScan( value="org.**.mapper.mysql", sqlSessionFactoryRef="mysqlSessionFactory" )