当前位置: 首页 > news >正文

怎么做整人网站wordpress制作客户端

怎么做整人网站,wordpress制作客户端,公司网站制作注意什么,俄语免费网站制作这里写目录标题 1 介绍2 使用2.1 开启 hook2.2 禁用 hook 3 手动指定 hook 1 介绍 SpringBoot 如果需要使用hook则需要开启spring.main.register-shutdown-hooktrue(默认为true) 如果使用kill -9则不会出发JVM的hook,kill可以正常触发hook server:port: 8080shutd…

这里写目录标题

  • 1 介绍
  • 2 使用
    • 2.1 开启 hook
    • 2.2 禁用 hook
  • 3 手动指定 hook

1 介绍

SpringBoot 如果需要使用hook则需要开启spring.main.register-shutdown-hook=true(默认为true)
如果使用kill -9则不会出发JVM的hook,kill可以正常触发hook

server:port: 8080shutdown: IMMEDIATE #GRACEFUL/IMMEDIATE (默认IMMEDIATE)spring:main:register-shutdown-hook: true #默认ture

2 使用

package com.example.java.test;import jakarta.annotation.PreDestroy;
import org.springframework.stereotype.Component;/*** @author hyacinth* @date 2023/10/13 23:07* @desc: 测试* @title: Test* @package com.example.java.test*/
@Component
public class Test {@PreDestroypublic void destroy() {System.out.println("销毁");}public Test() {System.out.println("创建");}}

2.1 开启 hook

如果spring.main.register-shutdown-hook=true

  .   ____          _            __ _ _/\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \\\/  ___)| |_)| | | | | || (_| |  ) ) ) )'  |____| .__|_| |_|_| |_\__, | / / / /=========|_|==============|___/=/_/_/_/:: Spring Boot ::                (v3.1.4)2023-10-13T23:11:26.801+08:00  INFO 18244 --- [  restartedMain] com.example.java.JavaApplication         : Starting JavaApplication using Java 21 with PID 18244 (D:\SourceCode\Intellij\java\target\classes started by xuhya in D:\SourceCode\Intellij\java)
2023-10-13T23:11:26.805+08:00  INFO 18244 --- [  restartedMain] com.example.java.JavaApplication         : No active profile set, falling back to 1 default profile: "default"
2023-10-13T23:11:26.916+08:00  INFO 18244 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2023-10-13T23:11:26.916+08:00  INFO 18244 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2023-10-13T23:11:28.594+08:00  INFO 18244 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2023-10-13T23:11:28.622+08:00  INFO 18244 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2023-10-13T23:11:28.623+08:00  INFO 18244 --- [  restartedMain] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.13]
2023-10-13T23:11:28.696+08:00  INFO 18244 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2023-10-13T23:11:28.697+08:00  INFO 18244 --- [  restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1779 ms
创建
2023-10-13T23:11:29.308+08:00  INFO 18244 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
2023-10-13T23:11:29.386+08:00  INFO 18244 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2023-10-13T23:11:29.403+08:00  INFO 18244 --- [  restartedMain] com.example.java.JavaApplication         : Started JavaApplication in 3.274 seconds (process running for 3.915)
销毁Process finished with exit code 130

2.2 禁用 hook

如果spring.main.register-shutdown-hook=false

如果spring.main.register-shutdown-hook=true```java.   ____          _            __ _ _/\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \\\/  ___)| |_)| | | | | || (_| |  ) ) ) )'  |____| .__|_| |_|_| |_\__, | / / / /=========|_|==============|___/=/_/_/_/:: Spring Boot ::                (v3.1.4)2023-10-13T23:11:26.801+08:00  INFO 18244 --- [  restartedMain] com.example.java.JavaApplication         : Starting JavaApplication using Java 21 with PID 18244 (D:\SourceCode\Intellij\java\target\classes started by xuhya in D:\SourceCode\Intellij\java)
2023-10-13T23:11:26.805+08:00  INFO 18244 --- [  restartedMain] com.example.java.JavaApplication         : No active profile set, falling back to 1 default profile: "default"
2023-10-13T23:11:26.916+08:00  INFO 18244 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2023-10-13T23:11:26.916+08:00  INFO 18244 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2023-10-13T23:11:28.594+08:00  INFO 18244 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2023-10-13T23:11:28.622+08:00  INFO 18244 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2023-10-13T23:11:28.623+08:00  INFO 18244 --- [  restartedMain] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.13]
2023-10-13T23:11:28.696+08:00  INFO 18244 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2023-10-13T23:11:28.697+08:00  INFO 18244 --- [  restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1779 ms
创建
2023-10-13T23:11:29.308+08:00  INFO 18244 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
2023-10-13T23:11:29.386+08:00  INFO 18244 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2023-10-13T23:11:29.403+08:00  INFO 18244 --- [  restartedMain] com.example.java.JavaApplication         : Started JavaApplication in 3.274 seconds (process running for 3.915)Process finished with exit code 130

3 手动指定 hook

package com.example.java;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplication
public class JavaApplication {public static void main(String[] args) {SpringApplication.run(JavaApplication.class, args);Runtime.getRuntime().addShutdownHook(new Thread(() -> {System.out.println("服务已停止");}));}}
  .   ____          _            __ _ _/\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \\\/  ___)| |_)| | | | | || (_| |  ) ) ) )'  |____| .__|_| |_|_| |_\__, | / / / /=========|_|==============|___/=/_/_/_/:: Spring Boot ::                (v3.1.4)2023-10-13T23:15:08.667+08:00  INFO 16108 --- [  restartedMain] com.example.java.JavaApplication         : Starting JavaApplication using Java 21 with PID 16108 (D:\SourceCode\Intellij\java\target\classes started by xuhya in D:\SourceCode\Intellij\java)
2023-10-13T23:15:08.671+08:00  INFO 16108 --- [  restartedMain] com.example.java.JavaApplication         : No active profile set, falling back to 1 default profile: "default"
2023-10-13T23:15:08.752+08:00  INFO 16108 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2023-10-13T23:15:08.752+08:00  INFO 16108 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2023-10-13T23:15:10.314+08:00  INFO 16108 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2023-10-13T23:15:10.335+08:00  INFO 16108 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2023-10-13T23:15:10.335+08:00  INFO 16108 --- [  restartedMain] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.13]
2023-10-13T23:15:10.402+08:00  INFO 16108 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2023-10-13T23:15:10.403+08:00  INFO 16108 --- [  restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1649 ms
创建
2023-10-13T23:15:10.914+08:00  INFO 16108 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
2023-10-13T23:15:10.996+08:00  INFO 16108 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2023-10-13T23:15:11.015+08:00  INFO 16108 --- [  restartedMain] com.example.java.JavaApplication         : Started JavaApplication in 3.038 seconds (process running for 3.626)
服务已停止
http://www.yayakq.cn/news/577388/

相关文章:

  • 响应式网站开发 三合一建站做一个网站团队需要哪些人员
  • 电子商务网站建设策划书腾讯服务器做网站
  • 广东智能网站建设费用在百度云上做网站
  • 漂亮大气网站华侨大学英文网站建设
  • 竞价网站做推广方案wordpress hooks
  • 婚纱网站策划书有了域名与服务器怎么建网站
  • 中文网站建设中做外贸用什么网站好
  • 个人网站推广广告微信小网站制作
  • 商务网站规划与网页制作广州凡科互联网科技股份有限公司
  • 网站开发语言用到天津滨海新区大爆炸
  • 淄博网站制作定制推广佛山禅城区网站建设公司
  • 最佳外贸建站平台网站建站平台系统
  • 江苏新有建设集团有限公司官方网站百度区域代理
  • wordpress评论导出廊坊首页霸屏排名优化
  • 租用服务器一般是谁帮助维护网站安全wordpress readium
  • 河北网站制作公司地址单机游戏大全
  • 自己在网上怎么做网站晋城市企业网站
  • 淘宝的好券网站怎么做网站建设技术方案模板
  • 网站设计一个页多少钱搜索优化报价
  • 宁波网站建设设计制作公司自己设置免费网站设计平台
  • 泰安企业网站建设电话网站移动端开发需要哪些技术
  • 提高网站订单转化率电子商务大型网站建设
  • 众创空间网站建设建设工程施工许可证在哪个网站办
  • 北京网站设计公司招聘信息360建筑网是什么平台
  • 建影楼网站多少钱wordpress外链转內链
  • 我的世界做图的网站网站 竞争分析
  • 注册公司制作网站腾讯分分彩做号网站
  • 网站的栏目设计南宁太阳能网站建设
  • 夏家胡同网站建设wordpress 80端口
  • 上海高品质网站建设广州各区最新动态