jbossモジュールの依存関係について質問があります。以下のよう は私が構造の春のアプリケーションを持っている:IMonitoring.classが監視クラスの契約
MonitoringFirst.classがmornitoringのための実装を提供を定義Jbossモジュールの依存関係
myApp.war/
--/WEB-INF
--/classes/com/myapp/monitoring/IMonitoring.class
--/classes/com/myapp/monitoring/MonitoringFirst.class
--/lib
my-core.jar
、またそれは、ロギング目的のために、私の-core.jarで定義されたいくつかのクラスを使用していますその後、私はjboss-におけるようにJBossモジュールにIMonitoring.classの別の実装を準備し、モジュールとしてsepatare瓶にそれを提供することを決めた
<bean id="myMonitoring" class="com.myapp.monitoring.MonitoringFirst">
:それは、私は次のようにBeanを定義する春に
私-core.jarに依存します配備-structure.xml私が持っているように:
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="com.myapp.my-customization" />
</dependencies>
</deployment>
</jboss-deployment-structure>
と私のモジュールはその後、私の春に私が使用することができます
<module xmlns="urn:jboss:module:1.0" name="com.myapp.my-customization">
<resources>
<resource-root path="customization.jar"/>
</resources>
<dependencies>
<module name="my-core.jar"/>
</dependencies>
</module>
内IMonitoring.classの第2の実現にjarファイルを定義し
<bean id="myMonitoring" class="com.myapp.monitoring.MonitoringSecond">
が、 MonitoringSecondはまた、私のcore.jarで定義されたいくつかのクラスをログの目的で使用しているので、私はcore-jarをjbossモジュールに移動しなければなりませんでした。そうでなければMonitoringSecond.classに必要なクラスは利用できません。 AVEにjava.lang.ClassNotFoundException:[モジュールからcom.myapp.LogManager:ローカルモジュールローダから "com.myapp.my-カスタマイズメイン" ....
Unfortunatelly class used for logging purpose (com.myapp.LogManager in my-core.jar) need information about name of the war in which it is called from, what can be achieved by asking for URL like
URL url = LogManager.class.getResource(LogManager.class.getSimpleName() + ".class");
but this gives different results:
when class is located in myApp.war/WEB-INF/lib it gives:
vfs:/C:/server/bin/content/myApp.war/WEB-INF/lib/my-core.jar/com/myapp/LogManager.class
and I can determine war name
when class is located in jboss module it gives:
jar:file:/C:/server/modules/system/layers/base/com/myapp/my-customization/main/my-core.jar!/com/myapp/LogManager.class
and here I don't have info about war name
最後に、実際の質問:
がありますMonitoringSecondクラスは、/ WEB-INF/libに定義されているLogManager.classを使用できるため、my-core.jarをjbossモジュールに移動する必要はありません。
もしそうでなければ、LogManager.classが呼び出された戦争の名前を決定する他の考え方はありますか?
私はそれをあまりにも混乱させませんでした。 ありがとうございました。よろしく。