0
在使用@Inject注入DAO的包含REST風格服務的wildfly中部署應用程序時遇到問題。Java EE 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類將包含一個實體後來經理,但目前它不像我至少想要注射工作一樣。有人有主意嗎?
謝謝,不知道有關命名註釋/駱駝案例的要求。 –
這是不正確的。如果我不得不猜測,你實際上錯過了一個範圍(假設你沒有定義'beans.xml'或者'beans.xml'爲你的bean類型說明'註釋') –
這不是真的。但在某些情況下,它是。我會說這是錯誤的實現,因爲在某些情況下,我省卻了類似的問題。 – msangel