慕姐4208626
@Configurationpublic 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; } }日志实现自己看着办,进去看看都有哪些实现吧