Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.alibabacloud.mse.demo;

import com.alibabacloud.mse.demo.bean.Consumer;
import com.alibabacloud.mse.demo.service.HelloServiceB;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -26,9 +27,9 @@ public class AController {
@Reference(application = "${dubbo.application.id}", version = "1.0.0")
private HelloServiceB helloServiceB;

@Value("${name:123}")
private String name;

@Autowired
private Consumer consumer;

@Autowired
RestTemplate restTemplate;
Expand All @@ -50,7 +51,7 @@ private void printConfig() {
EXECUTOR_SERVICE.scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {
System.out.println(name);
System.out.println(consumer.getName());
}
},0,2, TimeUnit.SECONDS);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.alibabacloud.mse.demo.bean;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;

@Component
@RefreshScope
@ConfigurationProperties()
public class Consumer {
private String name = "123";

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}
}