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);
}
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{...}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.