接上篇

1、pom.xml与上篇一致
2、新建包及Application启动类
  1. @Configuration
  2. @ComponentScan
  3. @EnableEurekaClient
  4. @EnableAutoConfiguration
  5. @RestController
  6. public class Application {
  7. @RequestMapping(value = "hello",method = RequestMethod.GET)
  8. public String hello(){
  9. return "你好,世界";
  10. }
  11. public static void main(String[] args){
  12. new SpringApplicationBuilder(Application.class).web(true)
  13. .run(args);
  14. }
  15. }
3、新建application.yml配置文件(我们尝试两种不同的配置)
  1. eureka:
  2. client:
  3. serviceUrl:
  4. defaultZone: http://localhost:1000/eureka/
  1. eureka:
  2. client:
  3. serviceUrl:
  4. defaultZone: http://localhost:1000/eureka/
  5. spring:
  6. application:
  7. name: client-service1
  8. server:
  9. port: 2000
4、运行,查看之前Erueka服务端的页面
Spring Cloud探路(二) Erueka客户端的建立
 

 




相关文章:

  • 2022-12-23
  • 2021-05-25
  • 2021-10-24
  • 2022-01-13
  • 2021-08-15
  • 2021-10-10
  • 2021-10-28
  • 2021-06-17
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-27
  • 2021-04-11
  • 2022-12-23
  • 2022-12-23
  • 2021-10-04
相关资源
相似解决方案