Announcement Announcement Module
Collapse
No announcement yet.
Unable to init PropertyPlaceholderConfigurer before CustomEditorConfigurer Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unable to init PropertyPlaceholderConfigurer before CustomEditorConfigurer

    I've recently added a CustomEditorConfigurer configuration to my ApplicationContext config. After doing so, my ApplicationContext fails to initialize becuase it "Cannot load JDBC driver class '${jdbc.driverClassName}'". This tells me that the CustomEditorConfigurer is being initialized before the PropertyPlaceholderConfigurer. I've tried setting an order on CustomEditorConfigurer (2147483647) and an order on PropertyPlaceholderConfigurer (-2147483648), but still no luck.

    The PropertyEditor configured by the CustomEditorConfigurer uses a Service wired to a HibernateDao, thus requiring LocalSessionFactoryBean, and DataSource to be initialized.

    If I removed the CustomEditorConfigurer bean declaration, or hard code my jdbc params for my dataSource instead of using the placeholders, everything works fine. I'm using Spring 2.0.6.

    This seems to be the same unresolved issue from this thread:
    http://forum.springframework.org/sho...t=37820&page=2

    Code:
    <bean id="propertyConfigurer"
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>classpath:/jdbc.properties</value>
                <value>classpath:/mail.properties</value>
                <value>classpath:/application.properties</value>
            </list>
        </property>
        <property name="order" value="-2147483648"/>
    </bean>
    
    <bean lazy-init="true" id="customEditorConfigurer" class="org.springframework.beans.factory.config.CustomEditorConfigurer">
        <property name="order" value="2147483647"/>
        <property name="customEditors">
            <map>
                <entry key="com.foo.domain.ListingType">
                    <bean id="genericEditor" class="com.foo.editor.AbstractDynamicEnumEditor">
                        <property name="genericLoaderService" ref="genericLoaderService" />
                    </bean>
                </entry>
            </map>
        </property>
    </bean>

  • #2
    Have you tried depends-on attribute?

    Code:
    <bean lazy-init="true" id="customEditorConfigurer" class="org.springframework.beans.factory.config.CustomEditorConfigurer"
     depends-on="propertyConfigurer">
    .............
    </bean>

    Comment

    Working...
    X