Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-810

SpringBeanProcessor does not process factory method beans correctly


    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • 3.0-beta-1, 2.3.5.Final
    • None
    • None

      Resteasy's SpringBeanProcessor does not work correctly with factory-method based beans:

      The example in the Spring-XML causes an IllegalStateException "could not find the type for bean named validator".

      <bean id="validatorFactory" class="javax.validation.Validation" factory-method="buildDefaultValidatorFactory" />
      <bean id="validator" factory-bean="validatorFactory" factory-method="getValidator" />

      SpringBeanProcessor is not able to detect the class for bean 'validator', which is required. SpringBeanProcessor supports factory-bean and factory-method attributes, but it does not quite do it right in the example above.

      Spring's class attribute defines two things:

      • Type of the bean OR
      • factory class to be used for a static factory method (if the factory-method attribute is used).

      SpringBeanProcessor does not work correctly for the latter because it uses javax.validation.Validation as the factory class where is should use javax.validation.ValidatorFactory (returned type of buildDefaultValidatorFactory)for the factory method getValidator.

            patriot1burke@gmail.com Bill Burke (Inactive)
            tine2k_jira Martin Maier (Inactive)
            6 Vote for this issue
            7 Start watching this issue