|
@@ -1,16 +1,8 @@
|
|
|
package com.citygis.provider;
|
|
|
|
|
|
-import com.citygis.provider.config.NacosConfigInfo;
|
|
|
-import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
-import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.boot.SpringApplication;
|
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
|
|
-import org.springframework.cloud.context.config.annotation.RefreshScope;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.PathVariable;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
@SpringBootApplication
|
|
|
@EnableDiscoveryClient
|
|
@@ -19,18 +11,4 @@ public class ProviderApplication {
|
|
|
public static void main(String[] args) {
|
|
|
SpringApplication.run(ProviderApplication.class, args);
|
|
|
}
|
|
|
-
|
|
|
- @RestController
|
|
|
- @RefreshScope
|
|
|
- public static class EchoController {
|
|
|
- @Autowired
|
|
|
- private NacosConfigInfo configInfo;
|
|
|
-
|
|
|
- @GetMapping("/echo/{string}")
|
|
|
- public String hello(@PathVariable String string) throws JsonProcessingException {
|
|
|
- ObjectMapper objectMapper = new ObjectMapper();
|
|
|
- String str = objectMapper.writeValueAsString(configInfo);
|
|
|
- return "Hello! I am Provider. info: " + str + string;
|
|
|
- }
|
|
|
- }
|
|
|
}
|