Unable to locate NamespaceHandler when using context:annotation-config
maven-assembly-plugin によってアセンブルされ、プロジェクトとそのすべての依存関係を含む jar を実行中 (java -jar)にエラーが発生しました。
他の人が forum.springsource.orgスレッド (メッセージ #7/8)META-INF/spring.handlers
で正しく発見したように、ファイルが異なる jar に存在するために問題が発生META-INF/spring.schemas
し、maven-assembly-plugin が jar を単一のファイルに再パッケージ化すると上書きされます。 .
2 つの spring-*.jar ファイルの内容を見ると、ファイルがクラスパスに対して相対的に同じ位置にあることがわかります。
$ jar tf spring-oxm-3.0.3.RELEASE.jar
META-INF/spring.handlers
META-INF/spring.schemas
org/springframework/oxm/GenericMarshaller.class
...
$ jar tf spring-context-3.0.3.RELEASE.jar
META-INF/spring.handlers
META-INF/spring.schemas
org/springframework/context/ApplicationContext.class
META-INF フォルダーを特定のパッケージに入れることはできませんか? もしそうなら、私が提案したいアイデアは(それが適用できることを願っています)、それらが参照するパッケージの下にMETA-INF/spring.shemas
とファイルを置くことです。META-INF/spring.handlers
$ jar tf spring-oxm-3.0.3.RELEASE.jar
org/springframework/oxm/META-INF/spring.schemas
org/springframework/oxm/META-INF/spring.handlers
org/springframework/oxm/GenericMarshaller.class
...
$ jar tf spring-context-3.0.3.RELEASE.jar
org/springframework/context/META-INF/spring.handlers
org/springframework/context/META-INF/spring.schemas
org/springframework/context/ApplicationContext.class
この方法では、単一の jar にマージされたときに競合しません。あなたはそれについてどう思いますか?