类 EmbeddedServerPortFileWriter
- java.lang.Object
- org.springframework.boot.system.EmbeddedServerPortFileWriter
- 所有已实现的接口:
EventListener
,org.springframework.context.ApplicationListener<EmbeddedServletContainerInitializedEvent>
public class EmbeddedServerPortFileWriter extends Object implements org.springframework.context.ApplicationListener<EmbeddedServletContainerInitializedEvent>
AnApplicationListener
that saves embedded server port and management port into file. This application listener will be triggered whenever the servlet container starts, and the file name can be overridden at runtime with a System property or environment variable named "PORTFILE" or "portfile".- 从以下版本开始:
- 1.4.0
构造器概要
构造器 构造器 说明 EmbeddedServerPortFileWriter()
Create a newEmbeddedServerPortFileWriter
instance using the filename 'application.port'.EmbeddedServerPortFileWriter(File file)
Create a newEmbeddedServerPortFileWriter
instance with a specified file.EmbeddedServerPortFileWriter(String filename)
Create a newEmbeddedServerPortFileWriter
instance with a specified filename.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected File
getPortFile(EmbeddedWebApplicationContext applicationContext)
Return the actual port file that should be written for the given application context.void
onApplicationEvent(EmbeddedServletContainerInitializedEvent event)
构造器详细资料
EmbeddedServerPortFileWriter
public EmbeddedServerPortFileWriter()
Create a newEmbeddedServerPortFileWriter
instance using the filename 'application.port'.
EmbeddedServerPortFileWriter
public EmbeddedServerPortFileWriter(String filename)
Create a newEmbeddedServerPortFileWriter
instance with a specified filename.- 参数:
filename
- the name of file containing port
EmbeddedServerPortFileWriter
public EmbeddedServerPortFileWriter(File file)
Create a newEmbeddedServerPortFileWriter
instance with a specified file.- 参数:
file
- the file containing port
方法详细资料
onApplicationEvent
public void onApplicationEvent(EmbeddedServletContainerInitializedEvent event)
- 指定者:
onApplicationEvent
在接口中org.springframework.context.ApplicationListener<EmbeddedServletContainerInitializedEvent>
getPortFile
protected File getPortFile(EmbeddedWebApplicationContext applicationContext)
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.- 参数:
applicationContext
- the source application context- 返回:
- the file that should be written