mybatis / spring-boot-starter

MyBatis integration with Spring Boot
Apache License 2.0
4.14k stars 1.79k forks source link

how to add a mybatis plugin use annotation? #80

Closed linzebingo closed 8 years ago

linzebingo commented 8 years ago

how to add a mybatis plugin use annotation?

CraKeyBoy commented 8 years ago

I use this configuration for mybatis plugin and that work ok. `@Configuration @AutoConfigureAfter(MybatisAutoConfiguration.class) public class MybatisPageHelperInterceptor {

@Bean
@ConditionalOnMissingBean
public PageHelper pageHelperInterceptor() {
    PageHelper pageHelper = new PageHelper();
    Properties properties = new Properties();
    properties.setProperty("reasonable", "true");
    properties.setProperty("supportMethodsArguments", "true");
    properties.setProperty("returnPageInfo", "check");
    properties.setProperty("params", "count=countSql");
    pageHelper.setProperties(properties);

    return pageHelper;
}

}` and spring boot will take this and mybatis can detect this plugin. Hope you have to help.

linzebingo commented 8 years ago

It worked : )