Using @Spy and @Autowired together
问题 I have a Service Class with 3 methods, Service class is also using some @Autowired annotations. Out of 3 methods, I want to mock two methods but use real method for 3rd one. Problem is: If I am using @Autowired with @Spy, all three real method implementation is being called. If I am using @Spy only, call to real method is return with Null pointer as there is no initialisation of Autowired objects. 回答1: I know about these two options: Use @SpyBean annotation from spring-boot-test as the only