learning-spring-boot-2nd-edition-code icon indicating copy to clipboard operation
learning-spring-boot-2nd-edition-code copied to clipboard

Chapter 4: ImageRepository bean not found

Open olegkamuz opened this issue 5 years ago • 3 comments

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;

olegkamuz avatar Jun 19 '20 14:06 olegkamuz

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

gregturn avatar Jun 19 '20 14:06 gregturn

2.3.0.RELEASE

olegkamuz avatar Jun 19 '20 16:06 olegkamuz

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

gregturn avatar Jun 19 '20 16:06 gregturn