【发布时间】:2019-10-18 03:46:27
【问题描述】:
我将List<Reception> 注入ReceptionService 类,但我得到的只是一个错误,项目不会部署:我得到的错误是:
Unsatisfied dependencies for type List<Reception> with qualifiers @Default
at injection point [BackedAnnotatedField] @Inject com.github.adminfaces.starter.service.ReceptionService.selectedPatients
at com.github.adminfaces.starter.service.ReceptionService.selectedPatients(ReceptionService.java:0)
我已经将 bean-discovery-mode="all" 设置为 beans.xml
List<Reception> selectedPatients 具有其 getter 和 setter 方法的 PatientList 类
import com.github.adminfaces.starter.model.Reception;
import com.github.adminfaces.starter.service.ReceptionService;
import org.omnifaces.cdi.ViewScoped;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
@Named
@ViewScoped
public class PatientListMB implements Serializable {
@Inject
ReceptionService receptionService;
Integer id;
LazyDataModel<Reception> patients;
Filter<Reception> filter = new Filter<>(new Reception());
List<Reception> selectedPatients; //patients selected in checkbox column
List<Reception> filteredValue;// datatable filteredValue attribute (column filters)
我正在注入 List<Reception> selectedPatients 的 ReceptionService 类
package com.github.adminfaces.starter.service;
import com.github.adminfaces.starter.infra.model.Filter;
import com.github.adminfaces.starter.infra.model.SortOrder;
import com.github.adminfaces.starter.model.Reception;
import com.github.adminfaces.template.exception.BusinessException;
import javax.ejb.Stateless;
import javax.inject.Inject;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import static com.github.adminfaces.template.util.Assert.has;
/**
* @author rmpestano
* Reception Business logic
*/
@Stateless
public class ReceptionService implements Serializable {
@Inject
List<Reception> selectedPatients;
【问题讨论】:
-
请改进您问题中的代码格式等