类 WebServerPortFileWriter
java.lang.Object
org.springframework.boot.web.context.WebServerPortFileWriter
public class WebServerPortFileWriter
extends Object
implements ApplicationListener<WebServerInitializedEvent>
An
ApplicationListener
that saves embedded server port and management port into
file. This application listener will be triggered whenever the server starts, and the
file name can be overridden at runtime with a System property or environment variable
named "PORTFILE" or "portfile".- 从以下版本开始:
- 2.0.0
- 作者:
- David Liu, Phillip Webb, Andy Wilkinson
-
构造器概要
构造器构造器说明Create a newWebServerPortFileWriter
instance using the filename 'application.port'.WebServerPortFileWriter
(File file) Create a newWebServerPortFileWriter
instance with a specified file.WebServerPortFileWriter
(String filename) Create a newWebServerPortFileWriter
instance with a specified filename. -
方法概要
修饰符和类型方法说明protected File
getPortFile
(ApplicationContext applicationContext) Return the actual port file that should be written for the given application context.void
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 org.springframework.context.ApplicationListener
supportsAsyncExecution
-
构造器详细资料
-
WebServerPortFileWriter
public WebServerPortFileWriter()Create a newWebServerPortFileWriter
instance using the filename 'application.port'. -
WebServerPortFileWriter
Create a newWebServerPortFileWriter
instance with a specified filename.- 参数:
filename
- the name of file containing port
-
WebServerPortFileWriter
Create a newWebServerPortFileWriter
instance with a specified file.- 参数:
file
- the file containing port
-
-
方法详细资料
-
onApplicationEvent
-
getPortFile
Return the actual port file that should be written for the given application context. The default implementation builds a file from the source file and the application context namespace if available.- 参数:
applicationContext
- the source application context- 返回:
- the file that should be written
-