3 回答
TA贡献1852条经验 获得超7个赞
@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; }
} |
日志实现自己看着办,进去看看都有哪些实现吧
添加回答
举报