マルチモジュールMavenプロジェクトを備えたGWT ServiceLocator
-
15-11-2019 - |
質問
私はマルチモジュールGWTプロジェクトであり、ServiceLocatorsを使用したいのですが。私は3つのモジュールを持っています:
- "クライアント"は共有によって異なります
- "共有"
- "server"は共有によって異なります
このようなServiceLocatorを書きました:
. ServiceLocatorのパッケージcom.google.gwt.RequestFactory.Sharedがあるため、public class TreeServiceLocator implements ServiceLocator { public Object getInstance(Class<?> clazz) { return new TreeService(); } }
を "Shared"モジュールに配置してください。ただし、TreeserviceがサーバーからBeanを返す必要があるため、これをコンパイルするとエラーが発生し、Springなどに対話する必要があります。
TreeServiceLocatorを実装する必要があるモジュール?また、「Shared」モジュールから「サーバー」を含めようとすると、Mavenは循環依存エラーをスローします。
ありがとうございました!
解決
Place the TreeServiceLocator
in the server
package, and use a @ServiceName
annotation instead of @Service
. These annotations have the same effect, but the former uses string literals instead of class literals. This will avoid problems with the GWT compile if the server types aren't available on the classpath of the GWT compiler.
所属していません StackOverflow