怎么通过接口安全退出春天的引导

  介绍

怎么通过接口安全退春天出引导吗?很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。

<强> 1,在砰的一声。xml中引入致动器、安全依赖

 & lt; dependency>
  & lt; groupId> org.springframework.boot
  & lt; artifactId> spring-boot-starter-actuator
  & lt;/dependency>
  & lt; dependency>
  & lt; groupId> org.springframework.boot
  & lt; artifactId> spring-boot-starter-security
  & lt;/dependency> 

<强> 2,在应用程序中。属性开启关闭端点(默认关闭)

#开启关闭   endpoints.shutdown.enabled=true   #自定义api地址   endpoints.shutdown。路径=/关闭

<强> 3,开启密码验证

对/admin目录开启密码验证。

endpoints.shutdown.sensitive=true   security.basic.enabled=true   security.basic.path=/管理   security.user.name=admin   security.user.password=测试   management.security.roles=超级用户   management.port=19888   management.context-path=/管理   management.security。启用=true

<强> 4,发送关闭HTTP请求

 curl - u“管理:test"- x发布http://127.0.0.1:19888/admin/关闭

<强> 5,返回内容

{   “message":“关闭,再见……“   }

看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注行业资讯频道,感谢您对的支持。

怎么通过接口安全退出春天的引导