I have a web application that reads and writes data from/to a database using JDBC.
The SQL statements used by this application are currently injected into the data layer of the application through a XML properties file using a PropertyPlaceholderConfigurer. In this way, the SQL code and the Java code are kept separate. The DBA can edit the properties files to tune the SQL without bothering the Java developement.
(See here for an example similar to how we do this, except that we inject each individual property by @Value rather than injecting a whole Properties object).
Eventually, I will have another application that should use the same repository as the web application. To that end, I'd like to refactor the data layer into its own component. I'd like to keep the SQL in this component. (i.e., I do not want to inject the SQL statements inside of the applications configuration file).
It seems like no problem using the tag in the XML configuration and the @Rpository annotation on the class to get the bean created. And I can still inject the SQL statements into this repository class. However, to do this, the web application needs to know about and load the XML properties file from inside of the client JAR (using a "classpath:..." entry).
Is there a way to get spring to do this injection without the WAR file needing to know the name of this properties file?