Kaynağa Gözat

:beers: Writing code drunkenly.spell error: fegin->feign

萌萌哒Sakura酱 6 yıl önce
ebeveyn
işleme
1106fc4367

+ 2 - 2
pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/feign/PigxFeginConfiguration.java

@@ -42,7 +42,7 @@ import org.springframework.security.oauth2.client.resource.OAuth2ProtectedResour
  */
 @Configuration
 @ConditionalOnClass(Feign.class)
-public class PigxFeginConfiguration {
+public class PigxFeignConfiguration {
 
 	@Bean
 	@ConditionalOnProperty("security.oauth2.client.client-id")
@@ -61,7 +61,7 @@ public class PigxFeginConfiguration {
 		public Feign.Builder feignHystrixBuilder(FeignContext feignContext) {
 			return PigxHystrixFeign.builder(feignContext)
 					.decode404()
-					.errorDecoder(new PigxFeginErrorDecoder());
+					.errorDecoder(new PigxFeignErrorDecoder());
 		}
 	}
 

+ 5 - 5
pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/feign/PigxFeginErrorDecoder.java

@@ -48,30 +48,30 @@ import static java.util.concurrent.TimeUnit.SECONDS;
  *
  * @author L.cm
  */
-public class PigxFeginErrorDecoder extends ErrorDecoder.Default {
+public class PigxFeignErrorDecoder extends ErrorDecoder.Default {
 	private final RetryAfterDecoder retryAfterDecoder = new RetryAfterDecoder();
 	private static final String REGEX = "^[0-9]+$";
 
 
 	@Override
 	public Exception decode(String methodKey, Response response) {
-		PigxFeginException exception = errorStatus(methodKey, response);
+		PigxFeignException exception = errorStatus(methodKey, response);
 		Date retryAfter = retryAfterDecoder.apply(firstOrNull(response.headers()));
 		return new RetryableException(exception.getMessage(), exception, retryAfter);
 	}
 
-	private static PigxFeginException errorStatus(String methodKey, Response response) {
+	private static PigxFeignException errorStatus(String methodKey, Response response) {
 		try {
 			if (response.body() != null) {
 				Reader reader = response.body().asReader();
-				return new PigxFeginException(R.builder()
+				return new PigxFeignException(R.builder()
 						.msg(IoUtil.read(reader))
 						.code(CommonConstants.FAIL).build());
 			}
 		} catch (IOException ignored) { // NOPMD
 		}
 		String message = format("status %s reading %s", response.status(), methodKey);
-		return new PigxFeginException(message);
+		return new PigxFeignException(message);
 	}
 
 	@Nullable

+ 3 - 3
pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/feign/PigxFeginException.java

@@ -29,16 +29,16 @@ import lombok.Getter;
  *
  * @author L.cm
  */
-public class PigxFeginException extends RuntimeException {
+public class PigxFeignException extends RuntimeException {
 	@Getter
 	private final R result;
 
-	public PigxFeginException(R result) {
+	public PigxFeignException(R result) {
 		super(result.getMsg());
 		this.result = result;
 	}
 
-	public PigxFeginException(String message) {
+	public PigxFeignException(String message) {
 		super(message);
 		this.result = R.builder()
 				.code(CommonConstants.FAIL)

+ 2 - 2
pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/feign/PigxFeginFallbackFactory.java

@@ -36,8 +36,8 @@ import java.util.concurrent.ConcurrentMap;
  */
 @Slf4j
 @NoArgsConstructor
-public final class PigxFeginFallbackFactory<T> implements FallbackFactory<T> {
-	public static final PigxFeginFallbackFactory INSTANCE = new PigxFeginFallbackFactory();
+public final class PigxFeignFallbackFactory<T> implements FallbackFactory<T> {
+	public static final PigxFeignFallbackFactory INSTANCE = new PigxFeignFallbackFactory();
 	private static final ConcurrentMap<Class<?>, Object> FALLBACK_MAP = new ConcurrentHashMap<>();
 
 	@SuppressWarnings("unchecked")

+ 2 - 2
pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/feign/PigxFeignFallbackMethod.java

@@ -27,8 +27,8 @@ public class PigxFeignFallbackMethod implements MethodInterceptor {
 				type.getName(), method.getName(), cause.getMessage());
 
 		if (R.class == method.getReturnType()) {
-			final R result = cause instanceof PigxFeginException ?
-					((PigxFeginException) cause).getResult() : R.builder()
+			final R result = cause instanceof PigxFeignException ?
+					((PigxFeignException) cause).getResult() : R.builder()
 					.code(CommonConstants.FAIL)
 					.msg(cause.getMessage()).build();
 			return result;

+ 1 - 1
pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/feign/PigxHystrixInvocationHandler.java

@@ -137,7 +137,7 @@ public final class PigxHystrixInvocationHandler implements InvocationHandler {
 				Object fallback;
 				try {
 					if (fallbackFactory == null) {
-						fallback = PigxFeginFallbackFactory.INSTANCE.create(target.type(), getExecutionException());
+						fallback = PigxFeignFallbackFactory.INSTANCE.create(target.type(), getExecutionException());
 					} else {
 						fallback = fallbackFactory.create(getExecutionException());
 					}

+ 1 - 1
pigx-common/pigx-common-security/src/main/resources/META-INF/spring.factories

@@ -1,3 +1,3 @@
 org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-  com.pig4cloud.pigx.common.security.feign.PigxFeginConfiguration,\
+  com.pig4cloud.pigx.common.security.feign.PigxFeignConfiguration,\
   com.pig4cloud.pigx.common.security.service.PigxUserDetailsServiceImpl