私はapache-tomcatで動作するWebアプリケーションのコードを含む開発用PCを持っています。このコードは、春と冬眠を使用し、.warを生成するために、私は 'gradle'を使う必要があります。spring + hibernate + gradle - > org.springframework.beans.factory.BeanCreationException
ORG:私はこの開発PCにこの.warファイルを生成するが、私は自分のローカルPCにすべてのコードをコピーして、この戦争を生成するとき、私はApacheを起動するとき、それは例外が発生したときに
すべてが大丈夫です.springframework.beans.factory.BeanCreationException:名前 'workflowController'を持つBeanの作成中にエラーが発生しました:自動依存依存の注入が失敗しました。ネストされた例外はorg.springframework.beans.factory.BeanCreationExceptionです:フィールドをautowireできませんでした:private com.test.test2.section.mastertables.listboxes.service.ListboxService com.test.test2.section.workflow.controller.AbstractController.listboxService;ネストされた例外はorg.springframework.beans.factory.BeanCreationExceptionです: 'listboxService'という名前のBeanを作成中にエラーが発生しました:autowired依存関係の注入が失敗しました。ネストされた例外はorg.springframework.beans.factory.BeanCreationExceptionです:フィールドをautowireできませんでした:private com.test.test2.section.mastertables.listboxes.service.ListboxCodeService com.test.test2.section.mastertables.listboxes.service.ListboxService。 listboxCodeService;ネストされた例外はorg.springframework.beans.factory.BeanCreationExceptionです: 'listboxCodeService'という名前のBeanを作成中にエラーが発生しました:autowired依存関係の注入が失敗しました。ネストされた例外はorg.springframework.beans.factory.BeanCreationExceptionです:メソッドをオートワイヤできませんでした:protected void com.test.test2.section.mastertables.listboxes.service.ListboxCodeService.setEntityDao(com.test.test2.section.generic.dao。 GenericEntityDao);ネストされた例外はorg.springframework.beans.factory.NoUniqueBeanDefinitionExceptionです:タイプ[com.test.test2.section.generic.dao.GenericEntityDao]の適格なBeanが定義されていません:予期される単一の一致するbeanですが見つかりました37:commonDao、reinsuranceDao、serviceDao、 masterServiceDao、poolDao、lookupCodeDao、lookupLangDao、listboxItemDao、listboxCodeDao、userDao、roleDao、contractDao、subContractDao、premiumsDao、selfRetentionDao、serviceContractDao、salarySumDao、logBookDao、productDao、technicalDataDao、reglementDao、cancellationDao、customerDao、mutableDao、messageSourceDao、populationDao、auditDao、reInsuranceSolutionDao、 premiumSplitODao、pensionFundDao、documentDao、tariffBasicsDao、mySamEmployeeDao、mySamServiceDao、mySamContractDao、mySamPensionFundDao、mySamRevInfoDao ...
私は2つのjarファイルGEを解凍していますdev PCと私のローカルPCに1つの違いがあり、唯一の違いは.classファイルにあり、残りは同じです:jars、.jsp ...私は両方のPCで同じgradleバージョンと同一のソースコード、同じJavaバージョンのgradle用の同じビルドファイル。私はあなたがこの問題に関して私に教えることができると思っています。
EDIT:
だから私は比較する二つの戦争のクラスをコンパイルできます。疑われるように、これは結果です:jarファイルを作業から
クラス:戦争を働いていないから
@Service
public class ListboxCodeService extends GenericService
{
public ListboxCodeService()
{
}
@Autowired
protected void setEntityDao(ListboxCodeDao entityDao)
{
this.entityDao = entityDao;
}
public ListboxCode getByCode(String code)
{
return ((ListboxCodeDao)entityDao).getByCode(code);
}
protected volatile void setEntityDao(GenericEntityDao x0)
{
setEntityDao((ListboxCodeDao)x0);
}
}
クラス:
@Service
public class ListboxCodeService extends GenericService
{
public ListboxCodeService()
{
}
@Autowired
protected void setEntityDao(ListboxCodeDao entityDao)
{
this.entityDao = entityDao;
}
public ListboxCode getByCode(String code)
{
return ((ListboxCodeDao)entityDao).getByCode(code);
}
@Autowired
protected volatile void setEntityDao(GenericEntityDao genericentitydao)
{
setEntityDao((ListboxCodeDao)genericentitydao);
}
}
違いがあります余分な@Autowiredは動作しないコードです。しかし、初期のJavaコードは次のとおりです。
@Service
public class ListboxCodeService extends GenericService<ListboxCode, ListboxCodeDao> {
@Autowired
@Override
protected void setEntityDao(ListboxCodeDao entityDao) {
this.entityDao = entityDao;
}
/**
* Gets the by code.
*
* @param code the code
* @return the by code
*/
public ListboxCode getByCode(String code) {
return entityDao.getByCode(code);
}
}
だから今、私の質問は、この余分な@Autowireを追加するための犯人が誰であるか、ですか?私が前に言ったように、それは同じコード、同じgradleバージョンと同じjavaバージョンです...どんな考えですか?私たちはこのDEV環境を他の目的のために使用する予定であり、その前に自分のローカルPCに作業バージョンを生成できるようにする必要があります。
setEntityDaoのためにListboxCodeSrviceを作成することが主な問題だと思われます。 GenericEntityDaoには多くの実装または子があります。クラス内の差異は重大な問題になる可能性があります。 ListboxService、ListboxCodeService、GenericEntityDaoなどを共有してください。 – Cyva
@Cyvaすべての 'commonDao、reinsuranceDao ...'はGenericEntityDaoを継承します。私はそれが例外が言うものだと思う。ここでの質問は、私はdev環境で戦争を生成するとき、それは動作しますが、私のローカルマシンで戦争が生成されたときではありません。 –
jarファイルの上に書かれているのは、classだけです。それは重要であり得る。しかし、これらの情報で私はあなたを助けることはできません。 – Cyva