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

  • Possible bug in CustomEditorConfigurer

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

    <bean id="petService" class="">
            <property name="petDao" ref="petDao"/>
    I register my properyties like so

     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?