mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
fix checkstyle
Signed-off-by: slievrly <slievrly@163.com>
This commit is contained in:
parent
fbd72a6000
commit
f36c94d3ed
@ -19,7 +19,6 @@ package com.alibaba.cloud.examples;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import io.seata.core.context.RootContext;
|
import io.seata.core.context.RootContext;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -32,21 +32,22 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|||||||
@Configuration
|
@Configuration
|
||||||
public class DatabaseConfiguration {
|
public class DatabaseConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@Primary
|
@Primary
|
||||||
@ConfigurationProperties("spring.datasource")
|
@ConfigurationProperties("spring.datasource")
|
||||||
public DataSource storageDataSource() {
|
public DataSource storageDataSource() {
|
||||||
return new DruidDataSource();
|
return new DruidDataSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public JdbcTemplate jdbcTemplate(DataSource dataSource) {
|
public JdbcTemplate jdbcTemplate(DataSource dataSource) {
|
||||||
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
|
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
|
||||||
|
|
||||||
jdbcTemplate.update("delete from account_tbl where user_id = 'U100001'");
|
jdbcTemplate.update("delete from account_tbl where user_id = 'U100001'");
|
||||||
jdbcTemplate.update("insert into account_tbl(user_id, money) values ('U100001', 10000)");
|
jdbcTemplate.update(
|
||||||
|
"insert into account_tbl(user_id, money) values ('U100001', 10000)");
|
||||||
|
|
||||||
return jdbcTemplate;
|
return jdbcTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,9 +18,7 @@ package com.alibaba.cloud.examples;
|
|||||||
|
|
||||||
import com.alibaba.cloud.examples.BusinessApplication.OrderService;
|
import com.alibaba.cloud.examples.BusinessApplication.OrderService;
|
||||||
import com.alibaba.cloud.examples.BusinessApplication.StorageService;
|
import com.alibaba.cloud.examples.BusinessApplication.StorageService;
|
||||||
|
|
||||||
import io.seata.spring.annotation.GlobalTransactional;
|
import io.seata.spring.annotation.GlobalTransactional;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -92,7 +90,8 @@ public class HomeController {
|
|||||||
ResponseEntity<String> response;
|
ResponseEntity<String> response;
|
||||||
try {
|
try {
|
||||||
response = restTemplate.postForEntity(url, request, String.class);
|
response = restTemplate.postForEntity(url, request, String.class);
|
||||||
} catch (Exception exx) {
|
}
|
||||||
|
catch (Exception exx) {
|
||||||
return "mock error";
|
return "mock error";
|
||||||
}
|
}
|
||||||
result = response.getBody();
|
result = response.getBody();
|
||||||
@ -123,4 +122,4 @@ public class HomeController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,4 +20,4 @@ seata.service.disable-global-transaction=false
|
|||||||
## if use config center
|
## if use config center
|
||||||
#seata.config.type=apollo
|
#seata.config.type=apollo
|
||||||
#seata.config.apollo.apollo-meta=http://192.168.1.204:8801
|
#seata.config.apollo.apollo-meta=http://192.168.1.204:8801
|
||||||
#seata.config.apollo.app-id=seata-server
|
#seata.config.apollo.app-id=seata-server
|
||||||
|
@ -32,20 +32,20 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|||||||
@Configuration
|
@Configuration
|
||||||
public class DatabaseConfiguration {
|
public class DatabaseConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@Primary
|
@Primary
|
||||||
@ConfigurationProperties("spring.datasource")
|
@ConfigurationProperties("spring.datasource")
|
||||||
public DataSource storageDataSource() {
|
public DataSource storageDataSource() {
|
||||||
return new DruidDataSource();
|
return new DruidDataSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public JdbcTemplate jdbcTemplate(DataSource dataSource) {
|
public JdbcTemplate jdbcTemplate(DataSource dataSource) {
|
||||||
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
|
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
|
||||||
|
|
||||||
jdbcTemplate.execute("TRUNCATE TABLE order_tbl");
|
jdbcTemplate.execute("TRUNCATE TABLE order_tbl");
|
||||||
|
|
||||||
return jdbcTemplate;
|
return jdbcTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -32,23 +32,24 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|||||||
@Configuration
|
@Configuration
|
||||||
public class DatabaseConfiguration {
|
public class DatabaseConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@Primary
|
@Primary
|
||||||
@ConfigurationProperties("spring.datasource")
|
@ConfigurationProperties("spring.datasource")
|
||||||
public DataSource storageDataSource() {
|
public DataSource storageDataSource() {
|
||||||
return new DruidDataSource();
|
return new DruidDataSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public JdbcTemplate jdbcTemplate(DataSource dataSource) {
|
public JdbcTemplate jdbcTemplate(DataSource dataSource) {
|
||||||
|
|
||||||
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
|
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
|
||||||
|
|
||||||
jdbcTemplate.update("delete from storage_tbl where commodity_code = 'C00321'");
|
jdbcTemplate.update("delete from storage_tbl where commodity_code = 'C00321'");
|
||||||
jdbcTemplate.update("insert into storage_tbl(commodity_code, count) values ('C00321', 100)");
|
jdbcTemplate.update(
|
||||||
|
"insert into storage_tbl(commodity_code, count) values ('C00321', 100)");
|
||||||
|
|
||||||
return jdbcTemplate;
|
return jdbcTemplate;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user