title: Access both runtime argument and other beans in a spring bean's constructor
body: <p>I have two beans in a spring-boot application:</p>
  <pre class="lang-java prettyprint-override"><code>@Component
  @Scope(BeanDefinition.SCOPE_PROTOTYPE)
  public class Shape {
  
      @Resource
      private ShapeService shapeService;
  
      private String name;
      private String description;
  
      public Shape(String name) {
          this.name = name;
          this.description = shapeService.getDescription();
      }
  }
  </code></pre>
  <pre class="lang-java prettyprint-override"><code>@Service
  public class ShapeService {
  
      public String getDescription() {
          return &quot;This is a shape.&quot;;
      }
  }
  
  </code></pre>
  <p>I created the <code>Shape</code> instance using the following code:</p>
  <pre class="lang-java prettyprint-override"><code>Shape shape = beanFactory.getBean(Shape.class, &quot;shape&quot;);
  </code></pre>
  <p>But I got a <code>NullPointerException</code> on the following line:</p>
  <pre class="lang-java prettyprint-override"><code>this.description = shapeService.getDescription();
  </code></pre>
  <p><code>shapeService</code> is null. Is there any way to use <code>shapeService</code> inside <code>Shape</code>'s constructor?</p>