DataTagApplication.java 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package com.primeton.datatag;
  2. import com.alibaba.nacos.api.config.ConfigType;
  3. import com.alibaba.nacos.api.config.annotation.NacosValue;
  4. import com.alibaba.nacos.spring.context.annotation.config.NacosPropertySource;
  5. import org.springframework.beans.factory.annotation.Value;
  6. import org.springframework.boot.SpringApplication;
  7. import org.springframework.boot.autoconfigure.SpringBootApplication;
  8. import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
  9. import org.springframework.web.bind.annotation.RequestMapping;
  10. import org.springframework.web.bind.annotation.RequestMethod;
  11. import org.springframework.web.bind.annotation.RequestParam;
  12. import org.springframework.web.bind.annotation.ResponseBody;
  13. import org.springframework.web.bind.annotation.RestController;
  14. import java.util.HashMap;
  15. import java.util.Map;
  16. @NacosPropertySource(dataId = "damp", type = ConfigType.YAML, autoRefreshed = true)
  17. @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
  18. @RestController
  19. public class DataTagApplication {
  20. @Value(value = "${hadoop.nameNodeUrl}")
  21. String hadoopUrl;
  22. @Value(value = "${hbase.url}")
  23. String hbaseUrl;
  24. @RequestMapping(value = "/hi", method = {RequestMethod.POST, RequestMethod.GET})
  25. @ResponseBody
  26. public Map<String, Object> sayHello(@RequestParam("name") String name) {
  27. final HashMap<String, Object> map = new HashMap<>();
  28. map.put("name", name);
  29. map.put("massage", "hello, " + name);
  30. map.put("hadoopUrl", hadoopUrl);
  31. map.put("hbaseUrl", hbaseUrl);
  32. return map;
  33. }
  34. public static void main(String[] args) {
  35. SpringApplication.run(DataTagApplication.class, args);
  36. System.out.println("/***************************************************/");
  37. System.out.println("/* */");
  38. System.out.println("/*(♥◠‿◠)ノ゙ cdhExecutor启动成功 ლ(´ڡ`ლ)゙ */");
  39. System.out.println("/* */");
  40. System.out.println("/***************************************************/");
  41. }
  42. }