我不确定我的代码有什么问题。我正在尝试学习 Spring Boot WebFlux。但是我无法运行应用程序,因为我收到以下错误
“ com.thomsoncodes.todo.controller.ToDoController 中构造函数的参数 0 需要一个无法找到的 'com.thomsoncodes.todo.repository.ToDoRespository' 类型的 bean。”
累了@Autowired 但我仍然有同样的错误。
这是我的代码
构建.gradle
plugins {
id 'org.springframework.boot' version '2.1.3.RELEASE'
id 'java'
}
apply plugin: 'io.spring.dependency-management'
group = 'com.thomsoncodes.todo'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-webflux'
compileOnly 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'io.projectreactor:reactor-test'
}
Run Code Online (Sandbox Code Playgroud)
应用类
package com.thomsoncodes.todo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringBootTodoWebfluxApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootTodoWebfluxApplication.class, args);
}
}
Run Code Online (Sandbox Code Playgroud)
控制器类
package com.thomsoncodes.todo.controller;
import org.springframework.web.bind.annotation.GetMapping;
import …Run Code Online (Sandbox Code Playgroud)