com.alibaba.boot.dubbo.DubboAutoConfiguration Maven / Gradle / Ivy
package com.alibaba.boot.dubbo;
import com.alibaba.boot.dubbo.endpoint.DubboEndpoint;
import com.alibaba.boot.dubbo.health.DubboHealthIndicator;
import com.alibaba.dubbo.config.ApplicationConfig;
import com.alibaba.dubbo.config.ProtocolConfig;
import com.alibaba.dubbo.config.RegistryConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
@EnableConfigurationProperties(DubboProperties.class)
public class DubboAutoConfiguration {
@Autowired
private DubboProperties dubboProperties;
@Bean
@ConditionalOnMissingBean
public ApplicationConfig applicationConfig() {
return dubboProperties.getApplication();
}
@Bean
@ConditionalOnMissingBean
public RegistryConfig registryConfig() {
return dubboProperties.getRegistry();
}
@Bean
@ConditionalOnMissingBean
public ProtocolConfig protocolConfig() {
return dubboProperties.getProtocol();
}
@Bean
@ConfigurationProperties(prefix = "endpoints.dubbo", ignoreUnknownFields = false)
public DubboEndpoint dubboEndpoint() {
return new DubboEndpoint();
}
@Bean
public DubboHealthIndicator dubboHealthIndicator() {
return new DubboHealthIndicator();
}
}