Merge pull request #24 from kissss/upgrade-dependence-version

Upgrade dependence version
This commit is contained in:
纳兰丶 2018-07-14 17:01:04 +08:00 committed by GitHub
commit 2a25a5d837
24 changed files with 93 additions and 123 deletions

View File

@ -28,7 +28,6 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import java.util.Objects;
import java.util.ServiceLoader;
@ -43,7 +42,7 @@ public class AdminConfiguration {
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurerAdapter() {
return new WebMvcConfigurer() {
@Override
public void addInterceptors(final InterceptorRegistry registry) {
registry.addInterceptor(new AuthInterceptor()).addPathPatterns("/**");

View File

@ -28,7 +28,7 @@ import com.hmily.tcc.common.bean.adapter.MongoAdapter;
import com.hmily.tcc.common.exception.TccRuntimeException;
import com.hmily.tcc.common.utils.DateUtils;
import com.hmily.tcc.common.utils.RepositoryPathUtils;
import com.mongodb.WriteResult;
import com.mongodb.client.result.UpdateResult;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -109,9 +109,9 @@ public class MongoCompensationServiceImpl implements CompensationService {
Update update = new Update();
update.set("lastTime", DateUtils.getCurrentDateTime());
update.set("retriedCount", retry);
final WriteResult writeResult = mongoTemplate.updateFirst(query, update,
final UpdateResult updateResult = mongoTemplate.updateFirst(query, update,
MongoAdapter.class, mongoTableName);
if (writeResult.getN() <= 0) {
if (updateResult.getModifiedCount() <= 0) {
throw new TccRuntimeException("更新数据异常!");
}
return Boolean.TRUE;

View File

@ -33,7 +33,7 @@ import com.hmily.tcc.common.utils.RepositoryPathUtils;
import com.hmily.tcc.core.spi.CoordinatorRepository;
import com.mongodb.MongoCredential;
import com.mongodb.ServerAddress;
import com.mongodb.WriteResult;
import com.mongodb.client.result.UpdateResult;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -121,8 +121,9 @@ public class MongoCoordinatorRepository implements CoordinatorRepository {
} catch (TccException e) {
e.printStackTrace();
}
final WriteResult writeResult = template.updateFirst(query, update, MongoAdapter.class, collectionName);
if (writeResult.getN() <= 0) {
final UpdateResult updateResult = template.updateFirst(query, update, MongoAdapter.class, collectionName);
if (updateResult.getModifiedCount() <= 0) {
throw new TccRuntimeException("更新数据异常!");
}
return ROWS;
@ -138,8 +139,8 @@ public class MongoCoordinatorRepository implements CoordinatorRepository {
} catch (TccException e) {
e.printStackTrace();
}
final WriteResult writeResult = template.updateFirst(query, update, MongoAdapter.class, collectionName);
if (writeResult.getN() <= 0) {
final UpdateResult updateResult = template.updateFirst(query, update, MongoAdapter.class, collectionName);
if (updateResult.getModifiedCount() <= 0) {
throw new TccRuntimeException("更新数据异常!");
}
return ROWS;
@ -151,8 +152,8 @@ public class MongoCoordinatorRepository implements CoordinatorRepository {
query.addCriteria(new Criteria("transId").is(id));
Update update = new Update();
update.set("status", status);
final WriteResult writeResult = template.updateFirst(query, update, MongoAdapter.class, collectionName);
if (writeResult.getN() <= 0) {
final UpdateResult updateResult = template.updateFirst(query, update, MongoAdapter.class, collectionName);
if (updateResult.getModifiedCount() <= 0) {
throw new TccRuntimeException("更新数据异常!");
}
return ROWS;

View File

@ -86,7 +86,6 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.46</version>
</dependency>
<dependency>
@ -102,24 +101,12 @@
</dependency>
<!-- zkclient -->
<dependency>
<groupId>com.101tec</groupId>
<artifactId>zkclient</artifactId>
<version>0.4</version>
<groupId>org.apache.curator</groupId>
<artifactId>curator-client</artifactId>
</dependency>
<!-- zookeeper -->
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
</dependency>
</dependencies>

View File

@ -25,7 +25,6 @@ import com.hmily.tcc.demo.dubbo.account.api.entity.AccountDO;
import com.hmily.tcc.demo.dubbo.account.api.service.AccountService;
import com.hmily.tcc.demo.dubbo.account.mapper.AccountMapper;
import com.hmily.tcc.demo.dubbo.inventory.api.dto.InventoryDTO;
import com.hmily.tcc.demo.dubbo.inventory.api.entity.InventoryDO;
import com.hmily.tcc.demo.dubbo.inventory.api.service.InventoryService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -82,7 +82,6 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.46</version>
</dependency>
<dependency>
@ -96,26 +95,13 @@
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
</dependency>
<!-- zkclient -->
<dependency>
<groupId>com.101tec</groupId>
<artifactId>zkclient</artifactId>
<version>0.4</version>
<groupId>org.apache.curator</groupId>
<artifactId>curator-client</artifactId>
</dependency>
<!-- zookeeper -->
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>

View File

@ -100,7 +100,6 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.46</version>
</dependency>
<dependency>
@ -114,26 +113,13 @@
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
</dependency>
<!-- zkclient -->
<dependency>
<groupId>com.101tec</groupId>
<artifactId>zkclient</artifactId>
<version>0.4</version>
<groupId>org.apache.curator</groupId>
<artifactId>curator-client</artifactId>
</dependency>
<!-- zookeeper -->
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
</dependency>
</dependencies>

View File

@ -59,12 +59,6 @@
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-feign</artifactId>
</dependency>
<!--spring boot的核心启动器-->
<dependency>
<groupId>org.springframework.boot</groupId>
@ -104,7 +98,11 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.46</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>

View File

@ -23,8 +23,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.context.annotation.ImportResource;
import org.springframework.cloud.openfeign.EnableFeignClients;
/**
* @author xiaoyu

View File

@ -1,7 +1,8 @@
server:
port: 8882
contextPath: /account-service
address: 0.0.0.0
servlet:
context-path: /account-service
spring:
@ -56,6 +57,8 @@ eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
instance:
prefer-ip-address: true
account-service :
ribbon.NFLoadBalancerRuleClassName : com.netflix.loadbalancer.RandomRule

View File

@ -61,6 +61,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>

View File

@ -30,7 +30,7 @@ import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
public class EurekaServerApplication {
public static void main(String[] args) {
new SpringApplicationBuilder(EurekaServerApplication.class).web(true).run(args);
new SpringApplicationBuilder(EurekaServerApplication.class).run(args);
}
}

View File

@ -51,12 +51,6 @@
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-feign</artifactId>
</dependency>
<!--spring boot的核心启动器-->
<dependency>
<groupId>org.springframework.boot</groupId>
@ -101,7 +95,11 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.46</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>

View File

@ -23,7 +23,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ImportResource;
/**

View File

@ -1,7 +1,8 @@
server:
port: 8883
contextPath: /inventory-service
address: 0.0.0.0
servlet:
context-path: /inventory-service
spring:
datasource:
@ -20,6 +21,8 @@ eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
instance:
prefer-ip-address: true
inventory-service :
ribbon.NFLoadBalancerRuleClassName : com.netflix.loadbalancer.RandomRule

View File

@ -47,25 +47,6 @@
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-ribbon</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-feign</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-netflix-eureka-client</artifactId>

View File

@ -23,7 +23,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ImportResource;
/**

View File

@ -20,7 +20,7 @@ package com.hmily.tcc.demo.springcloud.order.client;
import com.hmily.tcc.annotation.Tcc;
import com.hmily.tcc.demo.springcloud.order.configuration.MyConfiguration;
import com.hmily.tcc.demo.springcloud.order.dto.AccountDTO;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

View File

@ -20,7 +20,7 @@ package com.hmily.tcc.demo.springcloud.order.client;
import com.hmily.tcc.annotation.Tcc;
import com.hmily.tcc.demo.springcloud.order.configuration.MyConfiguration;
import com.hmily.tcc.demo.springcloud.order.dto.InventoryDTO;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

View File

@ -1,7 +1,8 @@
server:
port: 8884
contextPath: /
address: 0.0.0.0
servlet:
context-path: /
spring:
@ -21,7 +22,8 @@ eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
instance:
prefer-ip-address: true
logging:
level:

View File

@ -36,7 +36,6 @@
<module>hmily-tcc-spring-boot-starter-motan</module>
<module>hmily-tcc-spring-boot-starter-parent</module>
</modules>
<dependencies>
<dependency>
@ -58,6 +57,7 @@
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -19,10 +19,6 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-feign</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
@ -35,6 +31,15 @@
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>RELEASE</version>
</dependency>
</dependencies>
<build>

View File

@ -16,9 +16,9 @@
*/
package com.hmily.tcc.springcloud.interceptor;
import com.hmily.tcc.common.bean.context.TccTransactionContext;
import com.hmily.tcc.common.constant.CommonConstant;
import com.hmily.tcc.common.utils.GsonUtils;
import com.hmily.tcc.common.bean.context.TccTransactionContext;
import com.hmily.tcc.core.interceptor.TccTransactionInterceptor;
import com.hmily.tcc.core.service.HmilyTransactionAspectService;
import org.aspectj.lang.ProceedingJoinPoint;
@ -30,6 +30,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
/**
* SpringCloudHmilyTransactionInterceptor.
* @author xiaoyu

32
pom.xml
View File

@ -34,7 +34,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
<version>2.0.2.RELEASE</version>
</parent>
<developers>
@ -52,18 +52,18 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jdk.version>1.8</jdk.version>
<spring.version>4.3.9.RELEASE</spring.version>
<spring-cloud.version>Dalston.SR1</spring-cloud.version>
<dubbo.version>2.5.8</dubbo.version>
<spring.version>5.0.7.RELEASE</spring.version>
<spring-cloud.version>Finchley.RELEASE</spring-cloud.version>
<dubbo.version>2.6.2</dubbo.version>
<mongo.driver.version>3.5.0</mongo.driver.version>
<mysql-connector-java>5.1.40</mysql-connector-java>
<mysql-connector-java>5.1.46</mysql-connector-java>
<commons-lang3.version>3.3.2</commons-lang3.version>
<guava.version>21.0</guava.version>
<spring.data.mongodb.version>1.9.1.RELEASE</spring.data.mongodb.version>
<spring.data.mongodb.version>2.0.8.RELEASE</spring.data.mongodb.version>
<hessian.version>4.0.38</hessian.version>
<protostuff.version>1.0.8</protostuff.version>
<kryo.version>4.0.0</kryo.version>
<curator.version>2.9.1</curator.version>
<curator.version>4.0.1</curator.version>
<nettty.version>4.1.12.Final</nettty.version>
<commons.httpclient.version>3.0.1</commons.httpclient.version>
<httpclient.version>4.5.1</httpclient.version>
@ -74,11 +74,24 @@
<motan.version>1.0.0</motan.version>
<disruptor.version>3.4.0</disruptor.version>
<hikaricp.version>3.2.0</hikaricp.version>
<eureka.version>1.4.5.RELEASE</eureka.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka-server</artifactId>
<version>${eureka.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
<version>${eureka.version}</version>
</dependency>
<dependency>
<groupId>com.hmily.tcc</groupId>
<artifactId>hmily-tcc-admin</artifactId>
@ -373,6 +386,11 @@
<version>${curator.version}</version>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
<version>${curator.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>