autowired报错

package com.om.o2ov2.config.dao;
import com.mchange.v2.c3p0.ComboPooledDataSource;
import com.om.o2ov2.util.DESUtil;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.beans.PropertyVetoException;
@Configuration
@MapperScan("com.om.o2ov2.dao")
public class DataSourceConfiguration {
@Value("${myjdbc.driver}")
private String jdbcDriver;
@Value("${myjdbc.url}")
private String jdbcUrl;
@Value("${myjdbc.username}")
private String jdbcUsername;
@Value("${myjdbc.password}")
private String jdbcPassword;
/**
* 生成spring-dao.xml对应的bean dataSource
* @return
*/
@Bean(name = "dataSource")
public ComboPooledDataSource createDataSource() throws PropertyVetoException {
ComboPooledDataSource dataSource = new ComboPooledDataSource();
dataSource.setDriverClass(jdbcDriver);
dataSource.setJdbcUrl(jdbcUrl);
dataSource.setUser(DESUtil.getDecryptString(jdbcUsername));
dataSource.setPassword(DESUtil.getDecryptString(jdbcPassword));
dataSource.setMaxPoolSize(30);
dataSource.setMinPoolSize(10);
dataSource.setAutoCommitOnClose(false);
dataSource.setCheckoutTimeout(10000);
dataSource.setAcquireRetryAttempts(2);
return dataSource;
}
}配置了路由
50
收起
正在回答
1回答
同学你好,这个应该是检测级别比较高,造成的报错,并不影响程序的编译与执行。这里建议同学使用@Resource替代@Autowire试试。
如果我的回答解决了你的疑惑,请采纳。祝:学习愉快~
4. SSM到Spring Boot入门与综合实战
- 参与学习 人
- 提交作业 323 份
- 解答问题 8263 个
本阶段将带你学习主流框架SSM,以及SpringBoot ,打通成为Java工程师的最后一公里!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星