apache / apache/dubbo

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

Open
#15,814 1 comment 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
Java
Stars
41.6k
Forks
26.4k
Avg merge
15h 13m
Merged PRs (30d)
4

Description

### Pre-check

- [x] I am sure that all the content I provide is in English.

### Search before asking

- [x] I had searched in the [issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) 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

- [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)

Contributor guide

Open the contributing guide

Research direction

No files or tests are named. Start with the Java SDK example and the two @DubboService classes shown, then investigate how Spring’s @ConditionalOnMissingBean relates to Dubbo service registration; done means a documented, reproducible answer or a clearly scoped implementation proposal.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend, distributed-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.