org.springframework.boot.system

Class ApplicationHome

  • java.lang.Object
    • org.springframework.boot.system.ApplicationHome


  • public class ApplicationHome
    extends java.lang.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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.io.File getDir()
      Returns the application home directory.
      java.io.File getSource()
      Returns the underlying source used to find the home directory.
      java.lang.String toString() 
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ApplicationHome

        public ApplicationHome()
        Create a new ApplicationHome instance.
      • ApplicationHome

        public ApplicationHome(java.lang.Class<?> sourceClass)
        Create a new ApplicationHome instance for the specified source class.
        Parameters:
        sourceClass - the source class or null
    • Method Detail

      • getSource

        public java.io.File getSource()
        Returns the underlying source used to find the home directory. This is usually the jar file or a directory. Can return null if the source cannot be determined.
        Returns:
        the underlying source or null
      • getDir

        public java.io.File getDir()
        Returns the application home directory.
        Returns:
        the home directory (never null)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object