org.zodiac.autoconfigure.feign.annotation.EnableFeignConsumers Maven / Gradle / Ivy
package org.zodiac.autoconfigure.feign.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.context.annotation.Import;
import org.springframework.core.annotation.AliasFor;
import org.zodiac.core.remote.annotation.EnableRemoteRequestMapping;
import feign.Logger;
import feign.Retryer;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
/*排除@FeignConsumer的接口,如:业务层启动需注入的是data层feign实例这个场景(不需要创建业务层接口的feign实例)。*/
@EnableRemoteRequestMapping(packagePatternsUseForInclude = false)
@Import(value = {FeignConsumerConfigurerRegistrar.class, FeignConsumersRegistrar.class, BridgeSpringCloudFeignClientsRegistrar.class})
public @interface EnableFeignConsumers {
/**
* Refer: {@link #basePackages()}
*/
public static final String BASE_PACKAGES = "basePackages";
/**
* Refer: {@link #basePackageClasses()}
*/
public static final String BASE_PACKAGE_CLASSES = "basePackageClasses";
/**
* Refer: {@link #defaultConfiguration()}
*/
public static final String DEFAULT_CONFIGURATION = "defaultConfiguration";
@AliasFor(annotation = EnableRemoteRequestMapping.class, attribute = EnableRemoteRequestMapping.PACKAGE_PATTERNS)
String[] value() default {};
/**
* Base packages to scan for annotated components.
*
* @return packages
*/
@AliasFor(annotation = EnableRemoteRequestMapping.class, attribute = EnableRemoteRequestMapping.PACKAGE_PATTERNS)
String[] basePackages() default {};
/**
* Base packages to scan for annotated components.
*
* @return package classes
*/
Class>[] basePackageClasses() default {};
/**
* The default custom @Configuration
for all feign clients. Can contain override @Bean
* definition for the pieces that make up the client, for instance {@link feign.codec.Decoder},
* {@link feign.codec.Encoder}, {@link feign.Contract}, {@link Retryer}, {@link Logger}.
*
*
* The if empty, default refer to FeignConsumerFactoryBean#mergeFeignConfigurationSet()
.
* To see org.springframework.cloud.openfeign.FeignClientsConfiguration
for the defaults.
*
* @return list of default configurations
*/
Class>[] defaultConfiguration() default {};
/**
* List of classes annotated with {@code @SpringBootFeignClient} or {@code @FeignClient}. If not empty, disables
* classpath scanning.
*
* Notes: Valid when the current environment is running in the springcloud environment.
*
* @return list of FeignClient classes
*/
Class>[] clients() default {};
}