title: Spring @Value injection field validation between inject field
body: <p>So I have two parameters being injected by Spring <code>@Value</code> annotation. <code>minLength</code> and <code>maxLength</code>. Logically <code>minLength</code> must not be higher than <code>maxLength</code> and vice versa. This is what I have tried but failed.</p>
  
  <p>The exception is thrown with maxLength being <code>0</code>, But in my <code>application.properties</code> I set it as <code>7</code> (Tested before validation)</p>
  
  <pre><code>private int minLength;
  private int maxLength;
  
  @Min(5)
  @Value("${ com.manudcamera.webapi.uuid.minLength : 5} ")
  private void setMinLength(int minLength) {
      if ( minLength &gt; this.maxLength ) throw new IllegalArgumentException("minimum length cannot be greater than maximum length | min len: " + minLength + " max len: " + this.maxLength);
      this.minLength = minLength;
  }
  
  @Max(50)
  @Value("${ com.manudcamera.webapi.uuid.maxLength : 15 }")
  private void setMaxLength(int maxLength) {
      if ( maxLength &lt; this.minLength ) throw new IllegalArgumentException("maximum length cannot be greather than minimum length | min len: " + minLength + " max len: " + maxLength);
      this.maxLength = maxLength;
  }
  </code></pre>