Package org.springframework.boot.system
Class ApplicationHome
java.lang.Object
org.springframework.boot.system.ApplicationHome
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
ConstructorDescriptionCreate a newApplicationHome
instance.ApplicationHome
(Class<?> sourceClass) Create a newApplicationHome
instance for the specified source class. -
Method Summary
-
Constructor Details
-
ApplicationHome
public ApplicationHome()Create a newApplicationHome
instance. -
ApplicationHome
Create a newApplicationHome
instance for the specified source class.- Parameters:
sourceClass
- the source class ornull
-
-
Method Details
-
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
Returns the application home directory.- Returns:
- the home directory (never
null
)
-
toString
-