GitHub user java-my-life created a discussion: How to achieve the effect of
Spring's @ConditionalOnMissingBean in Dubbo ?
### Pre-check
- [X] I am sure that all the content I provide is in English.
### Apache Dubbo Component
Java SDK (apache/dubbo)
### Details
> 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:";
}
}
`
### Code of Conduct
- [X] I agree to follow this project's [Code of
Conduct](https://www.apache.org/foundation/policies/conduct)
GitHub link: https://github.com/apache/dubbo/discussions/15813
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]