I am attempting to inject a DataSource into a factory class I wrote. This factory was SUPPOSED to have static methods that would take a
String specifying SQL, and return a ResultSet from the SQL. This way I can call the code from a scriptlet in a
JSP?
The big question will be "WHY would any sane person want to do this?" The answer is that this is an existing application that I have to fix, but am not allowed to rewrite from scratch using DAOs (*grumble*). So, I wanted to replace a bunch of ugly
JDBC code in the scriptlet with something that looks like this:
However, Spring can't inject the datasource into a static variable (declared as "private static DataSource dataSource". If anyone has any ideas, I would LOVE to hear them. I don't want to have to instantiate the ResultSetFactory, because that seems to miss the point of a Factory class.
Here is my non-working code:
And here is my applicationContext.xml:
Again, any ideas are appreciated.