我在wildfly中部署应用程序时遇到问题,该应用程序包含使用@Inject注入DAO的RESTful服务。
尝试在wildfly中部署应用程序时,这是日志中的错误消息:
Deploying /home/john/codebase/servers/wildfly-8.2.0.Final/standalone/deployments/HouseCompetitionDashboard-1.0-SNAPSHOT.war
{"JBAS014671: Failed services" => {"jboss.deployment.unit.\"HouseCompetitionDashboard-1.0-SNAPSHOT.war\".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"HouseCompetitionDashboard-1.0-SNAPSHOT.war\".WeldStartService: Failed to start service
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type DAO with qualifiers @Default
at injection point [BackedAnnotatedField] @Inject private org.jmcdonnell.dashboard.services.PlayerService.dao
at org.jmcdonnell.dashboard.services.PlayerService.dao(PlayerService.java:0)
"}}
这些课程如下:
@Named
public class DAO {
}
@Stateless
@Path("player")
public class PlayerService {
@Inject
private DAO dao;
@POST
@Consumes({"application/xml", "application/json"})
public void create(Player entity) {
//dao.create(entity);
}
}
稍后DAO类将包含一个实体管理器,但目前它并不像我至少希望注入工作。有人有什么想法吗?
答案 0 :(得分:0)
@Named
annotaion期望某些名称和名称未设置 - 它会生成默认名称,但是,name会生成与bean的驼峰案例名称相同的名称。您需要尝试指定名称或使用驼峰案例作为bean名称。