View Full Version : Spring IDE and PropertyPlaceholderConfigurer
dholmes97
Apr 26th, 2005, 04:58 PM
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
Christian Dupuis
Apr 27th, 2005, 02:54 AM
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
Torsten Juergeleit
Apr 27th, 2005, 04:56 PM
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
dholmes97
Apr 29th, 2005, 11:04 AM
No problem. I understand the limitations, and I'm impressed with how quickly you responded! Having that be a warning is very workable.
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.