发布网友 发布时间:2022-04-20 00:37
共2个回答
热心网友 时间:2022-04-09 13:04
@Configuration
@EnableTransactionManagement
@MapperScan("com.*.*.mapper")
public class DataBaseConfig {
private final Logger log = LoggerFactory.getLogger(DataBaseConfig.class);
@Bean
@Primary
@ConfigurationProperties(prefix = "datasource.primary")
public DataSource dataSource() {
log.debug("Configuring Datasource");
return new DruidDataSource();
}
@Bean
public PlatformTransactionManager txManager() {
return new DataSourceTransactionManager(dataSource());
}
@Bean
public SqlSessionFactory sqlSessionFactoryBean() throws Exception {
SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
sqlSessionFactoryBean.setDataSource(dataSource());
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
sqlSessionFactoryBean.setMapperLocations(resolver
.getResources("classpath:/mapper/*.xml"));
return sqlSessionFactoryBean.getObject();
}
}
热心网友 时间:2022-04-09 14:22
defined in file [D:\Workspaces\MyEclipse 10\.metadata\.me_tcat\webapps\SSM\WEB-INF\classes\applicationContext-common.xml 这里是问题的核心, 更具配置文件创建bean失败, 你要好好看一下你的 配置文件了。 错误描述: Context initializ...