Results 1 to 4 of 4

Thread: Spring IDE and PropertyPlaceholderConfigurer

  1. #1
    Join Date
    Mar 2005
    Posts
    9

    Default Spring IDE and PropertyPlaceholderConfigurer

    We extend PropertyPlaceholderConfigurer to provide environment specific (D, Q, P) properties, but the Spring IDE seems to choke on lines like this:

    <constructor-arg index="0">
    <ref bean="${dataSourceBeanId}"/>
    </constructor-arg>

    It doesn't seem to understand the ${bla} notation for property placeholders. Am I missing something, or am I stuck with red X's every time I use a property value?

    Thanks,
    Dan

  2. #2
    Join Date
    Aug 2004
    Location
    Duesseldorf, Germany
    Posts
    1,210

    Default

    Hello dan,

    thanks for your report. I've entered a ticket at http://springide.org/project/ticket/33 . With version http://springide.org/project/changeset/299 I've just commited a small change which now checks if an invalid bean reference is caused by an property placeholder. If yes the validator creates a warning insteed of an error.

    Hope that works for you.

    Geetings
    Christian
    Christian Dupuis
    SpringSource, a division of VMware
    Lead, SpringSource Tools Team
    http://www.springsource.com
    http://twitter.com/cdupuis

  3. #3
    Join Date
    Aug 2004
    Location
    Frankfurt/Main, Germany
    Posts
    253

    Default

    Spring IDE's validator isn't able to create a "real" BeanFactory with all it's bells and whistles, e.g. auto-wiring or PlaceholderConfigurer. This is because it lives within it's own little world of an Eclipse plugin. It is isolated by it's own Eclipse plugin class loader and doesn't know about all the fancy stuff which is feasible with the Spring framework ;-).

    Meaning Spring IDE isn't able to instantiate any bean class defined in a Spring project's config file. So Spring IDE's validator is only able to create a "lightweight" version of a Spring BeanFactory holding bean descriptions (aka RootBeanDefinition or ChildBeanDefinition). Auto-wiring or PlaceholderConfigurer magic isn't feasable due to classloader restrictions. It makes no sense to fire-up a full-blown BeanFactory (which may contain e.g. JNDI lookups for Stateless EJBs or DataSources) only for validation purposes.

    Sorry, we can only provide the workaround which Christian already implemented.

    Cheers,
    Torsten

  4. #4
    Join Date
    Mar 2005
    Posts
    9

    Default Thanks!

    No problem. I understand the limitations, and I'm impressed with how quickly you responded! Having that be a warning is very workable.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •