Affects: \<5.3.1>


Spring “name” attribute of @SpyBean is not valid

i set name to "basicUserInfoPOExtMapper", but when MockitoPostProcessor#registerSpy invoked,got value is not the one i set Spring “name” attribute of @SpyBean is not valid

but, if i use @MockBean, it is valid. then i read the code ,i found when use @MockBean annotation, it will read the name attribute value of MockBean annotation first, but when use @SpyBean, it ignores the name attribute name, instead it use "beanNameGenerator.generateBeanName" directly.

maybe, to @MockBean and @SpyBean, there is some differences to distinguish by using name attribute??

Comment From: snicoll

Neither MockBean nor SpyBean are part of Spring Framework. Please do not post screenshots as these are generally not helpful.

If you have a question, please ask it on StackOverflow. If you believe you've found a bug, you need to raise it with the Spring Boot issue tracker, but please prepare first a small sample that the team can run themselves to reproduce the problem you're trying to describe.