1
0
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:
slievrly 2020-01-01 14:29:54 +08:00
parent fbd72a6000
commit f36c94d3ed
6 changed files with 44 additions and 44 deletions

View File

@ -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;

View File

@ -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;
} }
} }

View File

@ -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();

View File

@ -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;
} }
} }

View File

@ -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;
} }
} }