没有找到类型为 [HrEmployeesReportOutput] 的符合条件的 bean 用于依赖项:预计至少有 1 个 bean

No qualifying bean of type [HrEmployeesReportOutput] found for dependency: expected at least 1 bean

我在尝试 运行 springboot 应用程序时出现以下错误,我无法使用 @Autowired 注释注入 HrEmployeesReportOutput class,我尝试了其他方法,但没有成功.

你能帮我解决这个问题吗?

No qualifying bean of type [com.nearshoretechnology.focalpoint.interactors.hremployees.HrEmployeesReportOutput] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

@Controller
@RequestMapping("/management/hr/employees/report")
public class HrManagerEmployeeReportController {

    @Autowired
    private HrEmployeesReportOutput hrEmployeesReportPresenter;

    private HrEmployeesReportInput hrReportEmployees;

    @Secured({ HR_ADMIN, BENCH_ADMIN })
    @RequestMapping(method = RequestMethod.GET)
    public String index(Model model) {
        HrEmployeesReportForm form = new HrEmployeesReportForm();
        String username = SecurityContextHolder.getContext().getAuthentication().getName();
        form.setUsername(username);

        this.hrReportEmployees.setReportEmployeesPresenter(hrEmployeesReportPresenter);

        model.addAllAttributes(hrReportEmployees.employeeReport(form));

        return "management/hr/reports/employees";
    }

}


public interface HrEmployeesReportOutput extends InteractorOutput<HrEmployeesReportResult> {

}
public interface InteractorOutput<T> {

  Map<String, Object> generateViewModel(T result);
}
public class HrEmployeesReportResult extends BaseResult {}

public class BaseResult {}

public interface HrEmployeesReportInput {


    Map<String, Object> employeeReport(HrEmployeesReportForm form);

    void setReportEmployeesPresenter(HrEmployeesReportOutput presenter);



}

你应该至少有一个 class 来实现你的 HrEmployeesReportOutput 接口 如果您使用 @ComponentScan(如果您使用 spring-boot,则自动添加)您的 class 必须有注释 @Component

例如:

@Component public class HrEmployeesReportOutputImpl implements HrEmployeesReportOutput{...}