3 回答

TA貢獻(xiàn)1852條經(jīng)驗(yàn) 獲得超7個(gè)贊
@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; }
} |
日志實(shí)現(xiàn)自己看著辦,進(jìn)去看看都有哪些實(shí)現(xiàn)吧
添加回答
舉報(bào)