SpringBoot中JdbcTemplate和事务的实现
@Configuration
@ComponentScan(basePackages = "org.ljw")
@EnableTransactionManagement(proxyTargetClass = true)
public class SpringConfig {
@Bean
public DruidDataSource getDruidDataSource(){
DruidDataSource dataSource = new DruidDataSource();
InputStream inputStream = null;
try {
inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("druid.properties");
Properties properties = new Properties();
properties.load(inputStream);
dataSource.setDriverClassName(properties.getProperty("driver"));
dataSource.setUrl(properties.getProperty("url"));
dataSource.setUsername(properties.getProperty("user"));
dataSource.setPassword(properties.getProperty("pwd"));
} catch (IOException e) {
e