spring mavenマルチモジュールプロジェクトを設定しようとしています。 2台の子ウェブモジュールにtwo
ディスパッチャーサーブレット(Foo {Module A}、Bar {Module B})があります。私がしようとしているすべては私がmodule A
内module B
を輸入していたときに両方が戦争しているので、今の問題は、ある単一のすべてroot context
を設定し、それがモジュールAに、春AbstractAnnotationConfigDispatcherServletInitializer
と私はAbstractAnnotationConfigDispatcherServletInitializerを使用して2つのディスパッチャサーブレットを処理します。
AppContext extends AbstractAnnotationConfigDispatcherServletInitializer{
@Override
protected Class<?>[] getRootConfigClasses() {
return new Class[] { ... };
}
@Override
protected Class<?>[] getServletConfigClasses() {
return new Class[] { Foo.class, Bar.class* }; //Bar.class Desired but not getting
}
@Override
protected String[] getServletMappings() {
return new String[] { "/" };
}
}
のように構成していていると言うことですファイルにアクセスできません。Bar.class
にアクセスできません。 Module A
はWeb application with UI
であり、Module B
はREST API
である。
application Context
のいずれかを設定する方法はありますか、またはRESTモジュール用に別のアプリケーションコンテキストを作成する必要はありますか?
情報が必要な場合は、私に知らせてください。
のあなたのpom.xmlでのコードの下に追加します。しかし、 'module A'は** war **ファイルなので、他の' Servlet Configuration'は 'Module B'には表示されません – user7036414
ModuleAにModuleBをインポートする必要があります。あなたのmoduleBがjarファイルを生成すると仮定します。 – vikas
実際に 'module b'は悲しいことに' war'です – user7036414