tag:blogger.com,1999:blog-6474777515149871807.post6036911752506246497..comments2024-03-08T10:45:11.911+01:00Comments on Warlock's Thoughts: Spring @Autowired, JUnit and Mockitovarð-lokkur (warlock)http://www.blogger.com/profile/08196109352954198217noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-6474777515149871807.post-26523716241146754822012-12-06T13:41:41.931+01:002012-12-06T13:41:41.931+01:00I'd been fighting with this Mockito and @Autow...I'd been fighting with this Mockito and @Autowired issue for a few seconds and finally found your post. This is exactly what I needed;) Thx!Łukasz Sawickihttps://www.blogger.com/profile/05117171530409776673noreply@blogger.comtag:blogger.com,1999:blog-6474777515149871807.post-41740543415512457372011-03-25T15:35:03.633+01:002011-03-25T15:35:03.633+01:00Thanks for the post, I never thought of wiring the...Thanks for the post, I never thought of wiring the Mocked class through XML config.<br /><br />Regards,<br />Gordon Dickens<br /><br />twitter.com/gdickens<br />linkedin.com/in/gordondickens<br />Blog: technophile.gordondickens.comAnonymoushttps://www.blogger.com/profile/04303877833354237882noreply@blogger.comtag:blogger.com,1999:blog-6474777515149871807.post-22689302022102994542011-03-10T09:49:22.776+01:002011-03-10T09:49:22.776+01:00Well, I never had this problem, but I use a separa...Well, I never had this problem, but I use a separate test-context.xml file for my unit tests. This one imports the "real" context file and then defines the mocked beans. I never thought deeper about it, but maybe this just works fine because I use the @Component annotation for almost every Spring bean to define it.<br /><br />In short: It works for me just by using @Component, @Marcus K.https://www.blogger.com/profile/12792886275134892026noreply@blogger.com