Kaleb Tisnado Flores
Kaleb Tisnado Flores

Reputation: 45

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

I have the error below when trying to run a springboot application , I am not able to inject the HrEmployeesReportOutput class by using the @Autowired annotation, I tried other ways, but didnt work.

would you please help me with this?

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);



}

Upvotes: 0

Views: 174

Answers (1)

Yevhen Kovtun
Yevhen Kovtun

Reputation: 26

You should have at least one class which implements your HrEmployeesReportOutput interface And if you are using @ComponentScan (added automatically if you are using spring-boot) your class must have annotation @Component

For example:

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

Upvotes: 1

Related Questions