title: Spring boot initializing bean at startup with constructor parameters
body: <p>I need to initialize the following <code>PointQuadTree</code> class on startup using Spring Boot with constructor parameters, and make the object available throughout the application.  The constructor parameters 'minX, maxX, ...' need to come from the application.properties file.</p>
  
  <p><em>PointQuadTree</em></p>
  
  <pre><code>public class PointQuadTree&lt;T extends PointQuadTree.Item&gt; {
  
     private final Bounds mBounds;
  
     public PointQuadTree(double minX, double maxX, double minY, double maxY) {
        this(new Bounds(minX, maxX, minY, maxY));
     }
  
     ...
  
  }
  </code></pre>
  
  <p><em>Bounds</em></p>
  
  <pre><code>public class Bounds {
     public final double minX;
     public final double minY;
  
     public final double maxX;
     public final double maxY;
  
     public final double midX;
     public final double midY;
  
     public Bounds(double minX, double maxX, double minY, double maxY) {
        this.minX = minX;
        this.minY = minY;
        this.maxX = maxX;
        this.maxY = maxY;
  
        midX = (minX + maxX) / 2;
        midY = (minY + maxY) / 2;
     }
  
     ...
  }
  </code></pre>
  
  <p>I've tried annotating <code>PointQuadTree</code> with <code>@Component</code>, but there is not constructor without parameters.  Even if I add a constructor without parameters <code>Bounds</code> is <code>final</code>, so it cannot be set after <code>PointQuadTree</code> is initialized. Also <code>Bounds</code> has a constructor with parameters only.</p>
  
  <p>After <code>PointQuadTree</code> is initialized, I need it to sit in memory and need to be able to autowire it in other components to read/remove/add items.  I have no idea how to do this with Spring Boot.  Any help greatly appreciated.</p>