KKO*_*KKO 5 java spring spring-boot spring-cloud
我刚刚进入spring-cloud-config,我正在研究这个基础项目.我想知道是否可能以及如何重写此客户端以不使用Spring Boot.
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@EnableAutoConfiguration
@ComponentScan
@RestController
@RefreshScope
public class ClientApp {
@Value("${bar:World!}")
String bar;
@RequestMapping("/")
String hello() {
return "Hello " + bar + "!";
}
public static void main(String[] args) {
SpringApplication.run(ClientApp.class, args);
}
}
Run Code Online (Sandbox Code Playgroud)
这样做的原因是我们正在考虑在我们的Spring批量Web服务中使用spring-cloud-config,但是我们使用旧的spring和xmls,而不是spring boot.我找不到任何与此相关的文档.
| 归档时间: |
|
| 查看次数: |
2011 次 |
| 最近记录: |