|
|
|
[
Permlink
| « Hide
]
Dmitry Avdeev - 18 Oct 07 12:57
Hi Chris. Thanks for feedback. Regarding number 4: how do you have your PropertyPlaceholderConfigurer configured? Is it located in the same file/fileset as the property usage?
Regarding number 1: is the file located under your source roots? Why do you use absolute file path (which is not too reliable), instead of classpath or relative file path?
Regarding #4; the first line in the file is:
<bean class="gsa.shared.spring.PropertyReplacer"/> and this class extends PropertyPlaceholderConfigurer (does some extra stuff like understand dates) Regarding #1; the file is not located under the source root. The file contains a centrally-defined Spring bean which enables emailing and can be imported from any Spring App in the company as this drive is mapped from everyone's PC. I wonder how you justify the fact that the absolute path is "not too reliable"? What can you mean? There may be an alternative I suppose? How would you suggest I modify the classpath in order that this file be discoverable? My only argument against this is that it would NOT be clear from the Spring XML file exactly where the shared resource was located. I see no reason that it shouldn't be. Regarding #4: at the moment IDEA only supports PropertyPlaceholderConfigurer, not any subclasses.
There is already a JIRA request to treat PropertyPlaceholderConfigurer subclasses the say way as regular PPC beans: Chris, could you take a look at the comments for It may well do; I don't know how clever IDEA is being about this. All I need IDEA to do is decide that a PPC has been defined (whether it be a subclass or o/w) and then interpret ${x.y.z} values as being convertable to any model type (assuming there exists an appropriate Editor or the model type is convertable using a default Sprng Editor).
There isa further concern however. Spring allows you to alter the property pattern in the PPC and indeed we also use $[x.y.z] (i.e. square brackets). I would want these to be treated in the same manner. trouble is, IDEA could not possibly have any knowledge of this at design-time, so perhaps it's inevitable that this would raise a warning. Would be nice to have IDEA possibly treat both curly, square and normal brackets as possible property patterns. Regarding #1: You could have a jar including the file and address it as something like "classpath:config/spring/mail/internal-mail.xml". Anyway, IDEA cannot resolve any references to files outside of project.
But I can "attach source" to a JAR where the source is outside the project. Is this a "feature", or something that will be fixed? I don't expect to see errors when I'm doing something perfectly valid... if IDEA sees a "file:" in a Spring file, why can it not follow the path specified?
Chris, some more comments regarding #4:
Yes, it is a "feature" (or a "limitation", if you want). I can suppress error highlighting on such usages, but references to the beans in this file won't be resolved. You can copy the file into your project and include it in the same fileset as a workaround.
Well, when we start our application, we provide a list of .xml and .properties files. We have a "SpringMain" class which organises these using Spring's PPC class programmatically on startup.
Our PPC subclass which is defined in the XML file internally defines the placeholderPrefix and placeholderSuffix properties so it's impossible for IDEA to be aware of what they are at design-time. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||