多数据源打印sql日志配置:
@Bean @ConfigurationProperties(prefix = "mybatis.configuration") public org.apache.ibatis.session.Configuration globalConfiguration() { return new org.apache.ibatis.session.Configuration(); } @Bean("fawkesDataSourceFactory") @DependsOn("fawkesDataSource") public SqlSessionFactory dataSourceFactory() throws Exception { SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean(); configuration().setLogImpl(StdOutImpl.class); configuration().setMapUnderscoreToCamelCase(true); factoryBean.setDataSource(dataSource()); return factoryBean.getObject(); }
yml配置:
#控制台打印SQL mybatis: configuration:
#plus配置 # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
#mybatis配置 map-underscore-to-camel-case: true
标签:log,数据源,ibatis,apache,mybatis,configuration From: https://www.cnblogs.com/xiaozi718/p/17867948.html