1 回答
TA贡献2080条经验 获得超4个赞
你好,你可以这样做:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | @Configuration public class MyBatisConfig {
@Value("${spring.mybatis.isShowLog}") private String isShowLog;
@Autowired private DataSource dataSource;
@Bean(name = "sqlSessionFactory") public SqlSessionFactoryBean sqlSessionFactory( ApplicationContext applicationContext) throws Exception { SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); sessionFactory.setDataSource(dataSource); sessionFactory.setPlugins(new Interceptor[] { pageHelper() });
org.apache.ibatis.session.Configuration configuration = new org.apache.ibatis.session.Configuration(); if("true".equalsIgnoreCase(isShowLog)){ configuration.setLogImpl(StdOutImpl.class); }
sessionFactory.setMapperLocations(applicationContext.getResources("classpath:mapper/*.xml")); return sessionFactory; }
} |
日志实现自己看着办,进去看看都有哪些实现吧
- 1 回答
- 0 关注
- 3195 浏览
添加回答
举报