簡體   English   中英

沒有為依賴找到 [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{...}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM