当我尝试在 STS 中运行我的 Spring Boot 应用程序时,我得到了这个:
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 1 of constructor in com.greglturnquist.learningspringboot2.learningspringboot2.ImageService required a bean of type 'com.greglturnquist.learningspringboot2.learningspringboot2.ImageRepository' that could not be found.
Action:
Consider defining a bean of type 'com.greglturnquist.learningspringboot2.learningspringboot2.ImageRepository' in your configuration.
我尝试添加
compile ("com.greglturnquist.learningspringboot2.learningspringboot2.ImageRepository")
但这并build.gradle没有什么不同。我该如何解决这个问题?
这是我的 ImageRepository 类:
package com.greglturnquist.learningspringboot2.learningspringboot2;
import org.springframework.data.repository.reactive.ReactiveCrudRepository;
import reactor.core.publisher.Mono;
public interface ImageRepository extends ReactiveCrudRepository<Image, String> {
Mono<Image> findByName(String name);
}