apache/dubbo

[Feature] How does Dubbo achieve the effect of Spring's @ConditionalOnMissingBean?

Aberta

#15.814 aberto em 1 de dez. de 2025

 (1 comentário) (0 reação) (0 responsável)Java (26.453 forks)batch import
help wanted

Métricas do repositório

Stars
 (41.524 estrelas)
Métricas de merge de PR
 (Mesclagem média 7d 14h) (20 fundiu PRs em 30d)

Description

Pre-check

  • I am sure that all the content I provide is in English.

Search before asking

  • I had searched in the issues and found no similar feature requirement.

Apache Dubbo Component

Java SDK (apache/dubbo)

Descriptions

TestProvider has two implementation classes, TestServiceImpl and TestServiceExtImpl. I want to use @ConditionalOnMissingBean to load TestServiceImpl if the bean does not exist. How can I do this?

`

public interface TestProvider { String getName(); }

@ConditionalOnMissingBean(TestProvider.class) @DubboService(interfaceClass = TestProvider.class) public class TestServiceImpl implements TestService { @Override public String getName() { return "getName:TestServiceImpl:"; } }

@DubboService(interfaceClass = TestProvider.class) public class TestServiceExtImpl extends TestServiceImpl{ @Override public String getName() { return "TestServiceExtImpl:"; } } `

Related issues

No response

Are you willing to submit a pull request to fix on your own?

  • Yes I am willing to submit a pull request on my own!

Code of Conduct

Guia do colaborador