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
- Author:
- Phillip Webb, Raja Kolli
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a newApplicationHomeinstance.ApplicationHome(@Nullable Class<?> sourceClass) Create a newApplicationHomeinstance for the specified source class. -
Method Summary
Modifier and TypeMethodDescriptiongetDir()Returns the application home directory.getPath()Returns the path of the application home directory.@Nullable FileReturns the underlying source used to find the home directory.@Nullable PathReturns the path of the underlying source used to find the home directory.toString()
-
Constructor Details
-
ApplicationHome
public ApplicationHome()Create a newApplicationHomeinstance. -
ApplicationHome
Create a newApplicationHomeinstance 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 returnnullif the source cannot be determined.- Returns:
- the underlying source or
null
-
getSourcePath
Returns the path of the underlying source used to find the home directory. This is usually the jar file or a directory. Can returnnullif the source cannot be determined.- Returns:
- the underlying source path or
null - Since:
- 4.2.0
-
getDir
Returns the application home directory.- Returns:
- the home directory (never
null)
-
getPath
Returns the path of the application home directory.- Returns:
- the home path (never
null) - Since:
- 4.2.0
-
toString
-