pagehelper / pagehelper-spring-boot

pagehelper-spring-boot
MIT License
1.55k stars 311 forks source link

PageHelperAutoConfiguration @Configuration在包扫描com.github.*情况下失效 #179

Open king1314okok opened 1 month ago

king1314okok commented 1 month ago

spring.factory中包含com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration,说明不是用@Configuration包扫描机制,但PageHelperAutoConfiguration类上有@Configuration,在spring包扫描配置了com.github.*的情况下,会导致扫描到PageHelperAutoConfiguration类,优先触发@Configuration和@ConditionalOnBean,由于SqlSessionFactory是由spring autoconfig触发,此时还没有SqlSessionFactory这个bean,进而导致@ConditionalOnBean判定条件不成立,最终PageHelperAutoConfiguration添加interceptor直接失效

abel533 commented 1 month ago

分析的对,为什么扫描 com.github.* ?

king1314okok commented 1 month ago

分析的对,为什么扫描 com.github.* ? 有其他工具的包名是com.github.*,工具类的叫com.github还挺常见的...