Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 4: ImageRepository bean not found #16

Open
olegkamuz opened this issue Jun 19, 2020 · 3 comments
Open

Chapter 4: ImageRepository bean not found #16

olegkamuz opened this issue Jun 19, 2020 · 3 comments

Comments

@olegkamuz
Copy link

olegkamuz commented Jun 19, 2020

HomeControllerTests gets me "ImageRepository bean not found".
For me this version of annotation fixed the problem:

@MockBeans({ @MockBean(ImageService.class), @MockBean(ImageRepository.class) })
public class HomeControllerTests {

@Autowired
WebTestClient webClient;

@Autowired
ImageService imageService;
@gregturn
Copy link
Member

That's strange!

What version of Spring Boot are you using? The one supplied in the code, or did you upgrade.

Also, considering that Spring Boot 2.0 (the version in the book) is no longer supported, you may wish to take a peek at something a bit newer.

Check out => https://github.com/hacking-with-spring-boot/hacking-with-spring-boot-code

@olegkamuz
Copy link
Author

2.3.0.RELEASE

@gregturn
Copy link
Member

Yeah, the book’s code definitely hasn’t been upgraded to that version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants