赞
踩
mybatis.mapper-locations=classpath*:dao/*.xml
#mybatis.type-aliases-package=com.feihe.wxapp.bean
mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
上面配置如果配置完了还不管用,看看用下面的配置
@Bean(name = "guideSqlSessionFactory") @Primary public SqlSessionFactory guideSqlSessionFactory(@Qualifier("guideDataSource") DataSource guideDataSource) throws Exception { final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); /*设置打印sql */ org.apache.ibatis.session.Configuration configuration = new org.apache.ibatis.session.Configuration(); //重点是这里,新建一个Configuration对象设置进去SqlSessionFactoryBean configuration.setLogImpl(StdOutImpl.class); sessionFactory.setConfiguration(configuration); sessionFactory.setDataSource(guideDataSource); sessionFactory.setMapperLocations( new PathMatchingResourcePatternResolver().getResources(GuideDataSourceConfig.MAPPER_LOCATION)); sessionFactory.setPlugins(new Interceptor[]{pageHelper,paginationInterceptor(),optimisticLockerInterceptor()}); return sessionFactory.getObject(); }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。