I\'ve got a Spring component I\'d like to test and this component has an autowired attribute which I need to change for the purpose of unit testing. The problem is, that the
I created blog post on the topic. It contains also link to Github repository with working example.
The trick is using test configuration, where you override original spring bean with fake one. You can use @Primary and @Profile annotations for this trick.