这是面试时被问到的一个问题,后来在网上搜索了很多,我用了看起来比较简便的一种方法,就是这个链接中的方式一:正确、安全地停止SpringBoot应用服务
总共就三步:1.导入actuator依赖;2.配置properties文件;3.使用post方式发出shutdown信号
然而我得到的响应是这样的:,显然项目并没有终止
我是在windows上用idea直接启动的,用postman发出的post请求,
properties文件有个这样的报错:Deprecated: Endpoint sensitive flag is no longer customizable as Spring Boot no longer provides a customizable security auto-configuration,是版本问题吗?
我的项目端口是80,使用默认的http://localhost/actuator/shu...
访问还是会出现同样的问题
你的url地址有问题,默认是
http://host:port/actuator/shutdown
。然后如果仅是这样会有安全问题,最好自定义一下路径再仅接收本地IP访问。