Skip to content

Commit

Permalink
fix alibaba#69 default spring.dubbo.appname=${spring.application.name}
Browse files Browse the repository at this point in the history
  • Loading branch information
xionghui committed Mar 7, 2018
1 parent b01306f commit 3bdc07d
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

import com.alibaba.dubbo.config.ApplicationConfig;
import com.alibaba.dubbo.config.MonitorConfig;
Expand All @@ -30,9 +31,13 @@ public class DubboAutoConfiguration {

@Bean
@ConditionalOnMissingBean
public ApplicationConfig dubboApplicationConfig() {
public ApplicationConfig dubboApplicationConfig(Environment environment) {
String appname = this.properties.getAppname();
if (appname == null) {
appname = environment.getProperty("spring.application.name");
}
ApplicationConfig appConfig = new ApplicationConfig();
appConfig.setName(this.properties.getAppname());
appConfig.setName(appname);
return appConfig;
}

Expand Down

0 comments on commit 3bdc07d

Please sign in to comment.