(二)swagger集成spring boot+eureka
2018-02-24 18:07
471 查看
(二)swagger集成spring boot+eureka
上一节讲了swagger集成spring boot,现在我们来看下怎么再和eureka集成起来。在这里我们假设你已经拥有了一台启动了的eureka server实例。
(一)spring boot集成swagger
1、添加eureka依赖
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-eureka</artifactId> <version>1.3.1.RELEASE</version> </dependency>
2、添加eureka配置
在application配置中添加,我的项目中使用的yml。eureka: instance: prefer-ip-address: true status-page-url-path: /swagger-ui.html client: service-url: defaultZone: http://localhost:8761/eureka/[/code]
与eureka的集成实际上就是将eureka中本服务的健康检查地址换为swagger-ui的地址。这样我们在eureka界面就可以对所有注册到此的服务进行集中管理。
上面关于swagger集成eureka的核心配置:eureka.instance.prefer-ip-address: true
设置true,则跳转链接为微服务启动机器的ip+端口,设为false为微服务启动机器的名称+端口eureka.instance.status-page-url-path: /swagger-ui.html
设置跳转链接的path,默认为/infoeureka.client.service-url.defaultZone=http://localhost:8761/eureka/
eureka server的注册地址3、启动
启动微服务程序,我们在eureka页面可以看到注册信息
点击链接,跳转到swagger-ui页面
大功告成,奏是这么简单~
相关文章推荐
- springboot 集成 swagger生成在线文档
- Spring Boot 集成Swagger
- Spring Boot 集成Swagger
- Spring Boot教程六:集成swagger2
- SpringBoot系列十一:SpringBoot整合Restful架构(使用 RestTemplate 模版实现 Rest 服务调用、Swagger 集成、动态修改日志级别)
- 【springboot】springboot项目集成swagger的demo
- springboot 集成 swagger2
- Spring Boot 集成Swagger
- springboot+swagger集成
- 13.玩转Spring Boot 集成swagger2
- Swagger2 (2)由浅入深 集成springboot + springfox-swagger
- springboot (spring mvc)集成swagger
- springboot集成swagger的应用
- Spring Boot集成Swagger的Pageable参数问题
- spring-boot 集成 swagger 问题的解决
- Spring Boot 集成Swagger
- Spring Boot 集成Swagger
- Swagger SpringBoot 集成
- Spring Boot 集成 Swagger
- spring boot j集成seagger 加入拦截器后 swagger 不能访问