mybatis.configuration.log-impl=org.apache.ibatis.logging.nologging.NoLoggingImpl
- mybatis-plus:
- configuration:
- log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
- @Bean
- public SqlSessionFactory sqlSessionFactory() throws Exception {
- // 用 mybatis 的这里会有点区别, mybatis 用的是 SqlSessionFactoryBean
- MybatisSqlSessionFactoryBean sqlSessionFactoryBean = new MybatisSqlSessionFactoryBean();
- sqlSessionFactoryBean.setDataSource(dynamicDataSource());
- sqlSessionFactoryBean.setMapperLocations((new PathMatchingResourcePatternResolver()).getResources("classpath:mapper/*.xml"));
-
- // 关闭日志
- MybatisConfiguration configuration = new MybatisConfiguration();
- configuration.setLogImpl(NoLoggingImpl.class);
- sqlSessionFactoryBean.setConfiguration(configuration);
-
- return sqlSessionFactoryBean.getObject();
- }