All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zodiac.autoconfigure.feign.dubbo.FeignDubboAutoConfiguration Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version
package org.zodiac.autoconfigure.feign.dubbo;

import java.util.Collections;
import java.util.Set;

import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.source.ConfigurationPropertySources;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;
import org.zodiac.autoconfigure.feign.condition.ConditionalOnDubboEnabled;
import org.zodiac.autoconfigure.feign.condition.ConditionalOnFeignDubboEnabled;

/**
 * Scans for interfaces that declare they are feign clients (via
 * {@link org.springframework.cloud.openfeign.FeignClient}). Configures component scanning
 * directives for use with
 * {@link org.springframework.context.annotation.Configuration}
 * or {@link org.springframework.boot.SpringBootConfiguration} classes.
* * To see Implementation simulated of refer to org.springframework.cloud.openfeign.EnableFeignClients and * org.apache.dubbo.spring.boot.autoconfigure.DubboAutoConfiguration. */ @SpringBootConfiguration @ConditionalOnDubboEnabled @ConditionalOnFeignDubboEnabled @AutoConfigureAfter(value = {org.apache.dubbo.spring.boot.autoconfigure.DubboAutoConfiguration.class}) /*uninvalid?*/ @ConditionalOnClass(value = {org.apache.dubbo.rpc.RpcContext.class, org.apache.dubbo.config.AbstractConfig.class, feign.Client.class, org.zodiac.feign.core.FeignConsumerClientProvider.class, org.zodiac.feign.dubbo.FeignDubbo.class}) public class FeignDubboAutoConfiguration { public FeignDubboAutoConfiguration() { } @Bean protected feign.Feign.Builder dubboFeignBuilder(ApplicationContext applicationContext) { return new org.apache.dubbo.config.spring.beans.factory.annotation.DubboFeignBuilder(applicationContext); } @Bean @SuppressWarnings("unchecked") @ConditionalOnClass(value = {ConfigurationPropertySources.class}) @ConditionalOnProperty(name = org.apache.dubbo.spring.boot.util.DubboUtils.BASE_PACKAGES_PROPERTY_NAME) protected org.apache.dubbo.config.spring.beans.factory.annotation.FeignClientToDubboProviderConfigurer feignClientToDubboProviderConfigurer(Environment environment) { Set packagesToScan = environment.getProperty(org.apache.dubbo.spring.boot.util.DubboUtils.BASE_PACKAGES_PROPERTY_NAME, Set.class, Collections.emptySet()); return new org.apache.dubbo.config.spring.beans.factory.annotation.FeignClientToDubboProviderConfigurer(packagesToScan); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy