找不到依赖项的类型为[HrEmployeesReportOutput]的合格Bean:预计至少1个Bean

Kaleb Tisnado Flores:

尝试运行springboot应用程序时出现以下错误,我无法使用@Autowired批注注入HrEmployeesReportOutput类,但尝试了其他方法,但没有起作用。

您能帮我吗?

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



}
叶文·科夫通(Yevhen Kovtun):

您应该至少有一个实现您的HrEmployeesReportOutput接口的类,并且如果您正在使用@ComponentScan(如果使用spring-boot,则会自动添加)您的类必须具有注释@Component

例如:

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

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

<method>中方法setUserService的参数0需要一个类型为<service>的bean,但找不到该bean

()中的字段personRepository需要找不到类型为()的bean

找不到类型为String的Bean

春季安全性:NoSuchBeanDefinitionException:找不到类型为[org.springframework.security.config.annotation.ObjectPostProcessor]的合格Bean

NoSuchBeanDefinitionException期望至少有1个bean符合此依赖项的自动装配条件

构造函数需要一个找不到的bean类型

如何解决没有类型为'com.example.test.repository.ConfigRepository'的合格Bean:预期至少有1个可以自动接线的Bean

春季安全性-没有类型为'javax.sql.DataSource'的合格Bean:至少应有1个合格为自动装配候选的Bean

找不到类型为'java.security.KeyPair'的必需bean

没有可用的'ru.spb.repository.UserRepository'类型的合格Bean:预计至少有1个有资格作为自动装配候选者的Bean

字段需要一个类型为...的Bean,但找不到

没有可用的'com ...'类型的合格bean:期望至少有1个合格为autowire候选对象的bean。依赖注释:{}

没有可用类型为'xxx.xxx.xxx.xxx.MyUserDetailsService'的合格Bean:预期至少有1个合格为自动装配候选的Bean

没有定义类型为[]的合格bean

将参数传递给Bean时,未找到依赖项的类型为[java.lang.String]的合格Bean

@Autowired-没有找到至少1个依赖类型的合格bean

找不到Spring @Autowired Bean,找不到类型为[...]的合格Bean

期望至少有1个bean符合此依赖项的自动装配条件

NoSuchBeanDefinitionException:找不到与弹簧测试和Junit依赖的类型合格的bean

注入持久性依赖项失败;没有定义类型为[javax.persistence.EntityManagerFactory]的合格Bean

设置Spring配置:未找到依赖项的类型为[]的合格Bean

找不到与依赖关系有关的UserRepository类型的合格Bean:至少应有1个符合此依赖关系自动候选条件的Bean

找不到依赖项类型为[leanbizapps.monster.services.BatchService]的合格Bean

Spring MVC:使用@component找不到依赖项类型的合格Bean

未找到依赖项的类型为[PATHTOCLASS]的合格Bean:期望至少有1个符合此依赖项的自动装配候选条件的Bean

找不到依赖项[javax.sql.DataSource]的类型为[javax.sql.DataSource]的合格Bean。

在 Spring Boot 单表中找不到依赖类型的合格 bean

没有可用的“mypackage.repository”类型的合格 bean:预计至少有 1 个 bean 有资格作为自动装配候选

错误需要找不到类型为“XXX”的 bean