不说废话,项目中使用spring boot 1.5.7 + spring cloud Dalston.SR3版本 搭建,在访问actuator中的health端点时,刚开始只返回{“status”:"down"},没有详细的信息,最后查阅资料:a链接 得知spring boot 2.0 以下需要在配置文件中新增如下内容:management.security.enabled=false, spring boot 2.0 以上请参考 b链接 ,需要在配置文件中新增: management.endpoint.health.show-details=always 。

        第二个问题是,项目中访问health,发现返回的status总为down,显示详细信息后发现如下:

         发现是consul的状态一直为down导致,但是consul服务上显示所有服务都是正常的,还是在stackOverFlow这个伟大的网站上找到了原因 传送门 ,原来我spring cloud 版本使用的是 Dalston.SR3版本,这个版本的 spring-cloud-starter-consul-discovery 版本为 1.2.1 RELEASE,然而consul升级到1.x以后会有bug,需要把spring-cloud-starter-consul-discovery升级到1.3以上,然后我换成 Edgware.SR3 版本,返回正常:

GitHub 加速计划 / sp / spring-boot
39
7
下载
spring-projects/spring-boot: 是一个用于简化Spring应用开发的框架。适合用于需要快速开发企业级Java应用的项目。特点是可以提供自动配置、独立运行和内置的Tomcat服务器,简化Spring应用的构建和部署。
最近提交(Master分支:2 个月前 )
c3e51d32 A change in Spring Security [1] means that type validation is now performed by default by Spring Security. A breaking side-effect of this is that setting validateTypes to false no longer has an effect and the default JwtTypeValidator is still present. Its presence, wrapped in a DelegatingOAuth2TokenValidator, prevents a user's JwtTypeValidator bean from being used for type validation. This commit updates Boot's auto-configuration to change how the type validators are created. We avoid wrapping in a DelegatingOAuth2TokenValidator so that the user's custom JwtTypeValidator can be detected and used in place of the default. This requires us to create the JwtIssuerValidator rather than using the createDefaultWithIssuer method as it does not allow additional validators to be provided. Fixes gh-48301 [1] https://github.com/spring-projects/spring-security/commit/6d3b54df21ec0cffc30c8b3e0784220bd117a87d 17 小时前
a5a0ad2a * pr/48274: Polish "Relax conditions to create HttpService client with RestClient" Relax conditions to create HttpService client with RestClient Closes gh-48274 22 小时前
Logo

AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。

更多推荐