对于最新稳定版本,请使用Spring Boot 4.0.0spring-doc.cadn.net.cn

过程监控

Spring靴模块中,你可以找到两个类来创建通常对进程监控有用的文件:spring-doc.cadn.net.cn

默认情况下,这些写手不会被激活,但你可以启用它们:spring-doc.cadn.net.cn

扩展配置

META-INF/spring.factories文件中,你可以激活写入PID文件的监听器(或监听者):spring-doc.cadn.net.cn

org.springframework.context.ApplicationListener=\
org.springframework.boot.context.ApplicationPidFileWriter,\
org.springframework.boot.web.context.WebServerPortFileWriter

程序化支持过程监控

你也可以通过调用SpringApplication.addListeners(...)方法并传递相应的作家对象。 这种方法还可以让你在作家构造 函数。spring-doc.cadn.net.cn