public class WebServerPortFileWriter extends Object implements org.springframework.context.ApplicationListener<WebServerInitializedEvent>
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".Constructor and Description |
---|
WebServerPortFileWriter()
Create a new
WebServerPortFileWriter instance using the filename
'application.port'. |
WebServerPortFileWriter(File file)
Create a new
WebServerPortFileWriter instance with a specified file. |
WebServerPortFileWriter(String filename)
Create a new
WebServerPortFileWriter instance with a specified filename. |
Modifier and Type | Method and Description |
---|---|
protected File |
getPortFile(org.springframework.context.ApplicationContext applicationContext)
Return the actual port file that should be written for the given application
context.
|
void |
onApplicationEvent(WebServerInitializedEvent event) |
public WebServerPortFileWriter()
WebServerPortFileWriter
instance using the filename
'application.port'.public WebServerPortFileWriter(String filename)
WebServerPortFileWriter
instance with a specified filename.filename
- the name of file containing portpublic WebServerPortFileWriter(File file)
WebServerPortFileWriter
instance with a specified file.file
- the file containing portpublic void onApplicationEvent(WebServerInitializedEvent event)
onApplicationEvent
in interface org.springframework.context.ApplicationListener<WebServerInitializedEvent>
protected File getPortFile(org.springframework.context.ApplicationContext applicationContext)
applicationContext
- the source application contextCopyright © 2020 Pivotal Software, Inc.. All rights reserved.