Package org.springframework.boot.system
Class ApplicationHome
- java.lang.Object
- org.springframework.boot.system.ApplicationHome
public class ApplicationHome extends Object
Provides access to the application home directory. Attempts to pick a sensible home for both Jar Files, Exploded Archives and directly running applications.- Since:
- 2.0.0
Constructor Summary
Constructors Constructor Description ApplicationHome()
Create a newApplicationHome
instance.ApplicationHome(Class<?> sourceClass)
Create a newApplicationHome
instance for the specified source class.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description File
getDir()
Returns the application home directory.File
getSource()
Returns the underlying source used to find the home directory.String
toString()
Constructor Detail
ApplicationHome
public ApplicationHome()
Create a newApplicationHome
instance.
ApplicationHome
public ApplicationHome(Class<?> sourceClass)
Create a newApplicationHome
instance for the specified source class.- Parameters:
sourceClass
- the source class ornull
Method Detail
getSource
public File getSource()
Returns the underlying source used to find the home directory. This is usually the jar file or a directory. Can returnnull
if the source cannot be determined.- Returns:
- the underlying source or
null
getDir
public File getDir()
Returns the application home directory.- Returns:
- the home directory (never
null
)