title: error passing a value in a bean
body: <p>I'm getting an error when passing an integer through spring.</p>
  
  <pre><code>&lt;bean id="propConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;
          &lt;property name="location" value="/WEB-INF/application.properties"/&gt;
   &lt;/bean&gt;
  
  &lt;bean id="portListenerService" class="com.service.portListenerService" scope="prototype" lazy-init="true" parent="abstractService"&gt;
      &lt;property name="devicePort" value="${devicePort}"/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>portListenerService.java:</p>
  
  <pre><code>@Required
  public final void setDevicePort(Integer devicePort) {
      this.devicePort= devicePort;
  }
  </code></pre>
  
  <p>Is this the correct way to do this? Because I am getting an error:</p>
  
  <blockquote>
    <p>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'portListenerService' defined in ServletContext resource [/WEB-INF/service-config.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [int] for property 'devicePort'; nested exception is java.lang.IllegalArgumentException: Original must not be null</p>
  </blockquote>
  
  <p>Even when I hardcode the port instead of pulling it from <code>application.properties</code>, I get the same error. Is some other problem amiss?</p>