Skip to content

Commit

Permalink
2.0.0.RELEASE
Browse files Browse the repository at this point in the history
  • Loading branch information
sim-wangyan committed Mar 7, 2019
1 parent 95efbb3 commit 6053647
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
5 changes: 0 additions & 5 deletions x7-reyc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@
<artifactId>x7-core</artifactId>
<version>2.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>io.xream.x7</groupId>
<artifactId>x7-config</artifactId>
<version>2.0.0.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.github.resilience4j/resilience4j-spring-boot2 -->
<dependency>
<groupId>io.github.resilience4j</groupId>
Expand Down
3 changes: 2 additions & 1 deletion x7-reyc/src/main/java/io/xream/x7/EnableReyClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@

import io.xream.x7.reyc.ReyClientBeanRegistrar;
import io.xream.x7.reyc.ReyClientConfig;
import io.xream.x7.reyc.internal.CompensationHandler;
import org.springframework.context.annotation.Import;

import java.lang.annotation.*;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
@Import({ReyClientConfig.class,ReyClientBeanRegistrar.class})
@Import({CompensationHandler.class,ReyClientConfig.class,ReyClientBeanRegistrar.class})
public @interface EnableReyClient {

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ public ReyClientConfig(HttpClientProperies properies, CircuitBreakerRegistry cir
RetryRegistry retryRegistry = RetryRegistry.ofDefaults();
ClientResolver.init(properies, circuitBreakerRegistry, retryRegistry);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,23 @@

import io.xream.x7.reyc.LogBean;
import io.xream.x7.reyc.ReyCompensationService;
import x7.config.SpringHelper;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

public class CompensationHandler {
public class CompensationHandler implements ApplicationContextAware {

private static boolean isNotNeed = false;
private static ReyCompensationService service = null;

private static ApplicationContext context;

protected static void handle(LogBean logBean) {

if (isNotNeed == false) {
if (service == null){
try {
service = SpringHelper.getObject(ReyCompensationService.class);
service = context.getBean(ReyCompensationService.class);
}catch (Exception e){

}
Expand All @@ -44,4 +48,8 @@ protected static void handle(LogBean logBean) {
}
}

@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
context = applicationContext;
}
}
4 changes: 0 additions & 4 deletions x7-reyc/x7-reyc.iml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="x7-core" />
<orderEntry type="module" module-name="x7-config" />
<orderEntry type="library" name="Maven: org.jdom:jdom:1.1.3" level="project" />
<orderEntry type="library" name="Maven: net.sourceforge.jexcelapi:jxl:2.6.12" level="project" />
<orderEntry type="library" name="Maven: log4j:log4j:1.2.14" level="project" />
<orderEntry type="library" name="Maven: io.github.resilience4j:resilience4j-spring-boot2:0.13.2" level="project" />
<orderEntry type="library" name="Maven: io.vavr:vavr:0.9.2" level="project" />
<orderEntry type="library" name="Maven: io.vavr:vavr-match:0.9.2" level="project" />
Expand Down

0 comments on commit 6053647

Please sign in to comment.