![]() I don't have time to get into all of this today, but the solution to my problem was: but I don't have all the code with me to look up the exact class definitions at this time.) (Warning: What I wrote there may be a little ambiguous. In short, this ""unsatisfied dependency"" error message means that I can only have one DataSource defined in a Spring application context file if you plan to use that context file in Spring JDBC tests. I guess autowiring can be a good thing - I haven't used it yet - but in this case it caused me a ton of problems. In this application, I had created a number of database tests that basically just validate the syntax of my JDBC SQL database calls (which I really like, especially when the database schema is changing), but I hadn't paid attention to the fact that some of this worked because of the Spring autowire magic. This "unsatisfied dependency", "dataSource" error seemed horrible, but what really happened was that when I merged my separate application context files into one larger applicationContext.xml file, I learned that Spring uses autowiring in the background of some of my database tests. ![]() No unique bean of type is defined:Įxpected single matching bean but found 2: Unsatisfied dependency expressed through bean property 'dataSource': Wow, today I thought I was doing some good code cleanup, and in my nice, working application, I merged a couple of Spring application context files into one single application context file, and got this horrible-looking Spring " unsatisfied dependency" error message when trying to run my suite of unit tests:Įrror creating bean with name '.FTPFileMoverDaoTests':
0 Comments
Leave a Reply. |