質問

私はマルチモジュールGWTプロジェクトであり、ServiceLocatorsを使用したいのですが。私は3つのモジュールを持っています:

  • "クライアント"は共有によって異なります
  • "共有"
  • "server"は共有によって異なります

    このようなServiceLocatorを書きました:

    public class TreeServiceLocator implements ServiceLocator {
        public Object getInstance(Class<?> clazz) {
            return new TreeService();
        }
    }
    
    . ServiceLocatorのパッケージcom.google.gwt.RequestFactory.Sharedがあるため、

    を "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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top