Announcement Announcement Module
Collapse
No announcement yet.
Possible bug in CustomEditorConfigurer Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Possible bug in CustomEditorConfigurer

    I have the following defined in myapp-infrastructure.xml
    Code:
      <bean class="org.springframework.beans.factory.config.CustomEditorConfigurer" lazy-init="true">
            <property name="propertyEditorRegistrars">
                <list>
                    <ref bean="customPropertyEditorRegistrar"/>
                </list>
            </property>
        </bean>
    
     <bean id="customPropertyEditorRegistrar" class="my-app.infrastructure.CustomPropertyEditorRegistrar" lazy-init="true">
            <property name="perService" ref="petService"/>
    	</bean>
    I also have the perService defined in myapp-service.xml like so

    Code:
    	 
    <bean id="petService" class="my-app.pet.petService">
            <property name="petDao" ref="petDao"/>
        </bean>
    I register my properyties like so

    Code:
     public void registerCustomEditors(PropertyEditorRegistry registry) {
    registry.registerCustomEditor(Pet.class, new PetPropertyEditor(PetService));
    }

    Some of my Service methods are annotated with the Transactional annotation.

    When I attach a debugger to my application service and view these service methods injected I can see that the service classes are proxied, however when I run the tests the proxies disappear, what I believe is happening is that the CustomEditorConfigurer is being instantiated in my test before the classes are scanned for annotations and because the service is set up as a singleton it just keeps returning me a concrete implementation rather then the proxy. When I set up my service class to be a prototype I still get a concrete class injected into the CustomEditorConfigurer, however my tests have the correct proxied instance injected into them. I have also tried telling CustomEditorConfigurer and customPropertyEditorRegistrar to be lazy beans however so far they refuse.

    Should I file this in JIRA?

    Cheers,
    Richard
Working...
X