Skip to content

Commit

Permalink
Polish apache#496 : [Issue] Dubbo Spring Boot 2.7.1 PropertyResolver …
Browse files Browse the repository at this point in the history
…Beans conflict in Spring Boot, ref apache#459 apache#496
mercyblitz committed Aug 6, 2019
1 parent 9bc8201 commit 6cd2de5
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
import org.apache.dubbo.config.spring.context.annotation.DubboConfigConfiguration;
import org.apache.dubbo.config.spring.context.annotation.EnableDubboConfig;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
@@ -32,6 +33,8 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Primary;
import org.springframework.core.env.Environment;
import org.springframework.core.env.PropertyResolver;

import java.util.Set;
@@ -105,4 +108,17 @@ protected static class SingleDubboConfigConfiguration {
@Import(DubboConfigConfiguration.Multiple.class)
protected static class MultipleDubboConfigConfiguration {
}

/**
* Build a primary {@link PropertyResolver} bean to {@link Autowired @Autowired}
*
* @param environment {@link Environment}
* @return alias bean for {@link Environment}
* @since 2.7.3
*/
@Bean
@Primary
public PropertyResolver primaryPropertyResolver(Environment environment) {
return environment;
}
}

0 comments on commit 6cd2de5

Please sign in to comment.