Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.example.repository.ExampleRepository]: Specified class is an interface
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:77)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1311)
... 39 more
From this:
@SpyBean
private ExampleRepository<ExampleData> exampleRepository;
to this:
@SpyBean
private ExampleRepository exampleRepository;
Issue
Starting from Spring-Boot 3.2.x the @spybean is not able to initialize MongoRepository bean of the generic type.
Please check the example project: https://github.com/pavlo-reshetniak/spybean-issue-example
How to reproduce
Result
Possible workaround