mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
@@ -19,7 +19,6 @@ package com.alibaba.cloud.examples;
|
||||
import java.util.Random;
|
||||
|
||||
import io.seata.core.context.RootContext;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@@ -32,21 +32,22 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
||||
@Configuration
|
||||
public class DatabaseConfiguration {
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
@ConfigurationProperties("spring.datasource")
|
||||
public DataSource storageDataSource() {
|
||||
return new DruidDataSource();
|
||||
}
|
||||
@Bean
|
||||
@Primary
|
||||
@ConfigurationProperties("spring.datasource")
|
||||
public DataSource storageDataSource() {
|
||||
return new DruidDataSource();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public JdbcTemplate jdbcTemplate(DataSource dataSource) {
|
||||
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
@Bean
|
||||
public JdbcTemplate jdbcTemplate(DataSource dataSource) {
|
||||
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
|
||||
jdbcTemplate.update("delete from account_tbl where user_id = 'U100001'");
|
||||
jdbcTemplate.update("insert into account_tbl(user_id, money) values ('U100001', 10000)");
|
||||
jdbcTemplate.update("delete from account_tbl where user_id = 'U100001'");
|
||||
jdbcTemplate.update(
|
||||
"insert into account_tbl(user_id, money) values ('U100001', 10000)");
|
||||
|
||||
return jdbcTemplate;
|
||||
}
|
||||
return jdbcTemplate;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user