sofastack/sofa-rpc-boot-projects

SofaBootRpcAutoConfiguration中的所有@bean没有@Conditional

Closed this issue · 0 comments

Describe the bug

因为有自定义registry需求,所以想自定义AutoConfiguration去创建新的registryConfigMap,可是在SofaBootRpcAutoConfiguration中没有使用Conditional导致也没好的办法解决

Expected behavior

可以自定义registryConfigMap或者覆盖registryConfigMap

Actual behavior

Steps to reproduce

Minimal yet complete reproducer code (or GitHub URL to code)

@Configuration
@EnableConfigurationProperties(SofaBootRpcProperties.class)
@AutoConfigureAfter(SofaBootRpcAutoConfiguration.class)
public class MyCimBootRpcAutoConfiguration {

    @Primary
    @Bean(name = "registryConfigMap")
    public Map<String, RegistryConfigureProcessor> configureProcessorMap() {
        Map<String, RegistryConfigureProcessor> map = new HashMap<String, RegistryConfigureProcessor>(6);
        map.put(SofaBootRpcConfigConstants.REGISTRY_PROTOCOL_LOCAL, new LocalFileConfigurator());
        map.put(SofaBootRpcConfigConstants.REGISTRY_PROTOCOL_ZOOKEEPER, new ZookeeperConfigurator());
        map.put(SofaBootRpcConfigConstants.REGISTRY_PROTOCOL_MESH, new MeshConfigurator());
        map.put(SofaBootRpcConfigConstants.REGISTRY_PROTOCOL_CONSUL, new ConsulConfigurator());
        map.put(SofaBootRpcConfigConstants.REGISTRY_PROTOCOL_NACOS, new NacosConfigurator());
        map.put(MyCimBootRpcConfigConstants.REGISTRY_PROTOCOL_DATABASE, new DataBaseConfigurator());
        return map;
    }
}