spring-batch-admin-manager で /META-INF/spring/batch/servlet/manager/manager-context.xml をオーバーライドする方法はありますか? ホームとファイルのメニュー (標準メニュー) を削除したいと考えています。下のナビゲーション メニュー バーのスクリーンショットを添付してください。
webapp の src/main/resources/META-INF/spring/batch/override フォルダーの下に manager-context.xml の複製を作成し、次のコード行をコメントアウトしようとしました。
<bean class="org.springframework.batch.admin.web.HomeMenu" parent="baseMenu"/>
<bean class="org.springframework.batch.admin.web.FilesMenu" parent="baseMenu"/>
ただし、spring-batch-admin-manager.jar の元の manager-context.xml が最初にロードされ、アプリケーション固有の manager-context.xml が後でロードされるため、重複したメニューが作成されます。
また、webapp からのみ manager-context.xml をロードして、webapp コンテキストを初期化する方法を変更しようとしました。これが私の webapp-context.xml です。ここにコメントを追加して、webapp からのみ manager-context.xml をロードしようとしている方法を説明しました。
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<import resource="classpath*:/META-INF/spring/batch/servlet/resources/*.xml" />
<import resource="classpath*:/META-INF/spring/batch/bootstrap/**/*.xml" />
<import resource="classpath*:/META-INF/spring/batch/override/**/*.xml" />
<!-- Instead of loading manager-context from spring-batch-admin-manager.jar,
the following line is commented out -->
<!-- <import resource="classpath*:/META-INF/spring/batch/servlet/manager/*.xml" /> -->
<!-- Load the manager-context.xml from my web application -->
<import resource="classpath*:/servlet/manager/manager-context.xml" />
<import resource="classpath*:/META-INF/spring/batch/servlet/manager/contoller-context.xml" />
<import resource="classpath*:/META-INF/spring/batch/servlet/manager/integration-context.xml" />
<import resource="classpath*:/META-INF/spring/batch/servlet/override/*.xml" />
<!-- Override the standard location for spring batch admin resources -->
<bean id="resourceService" class="org.springframework.batch.admin.web.resources.DefaultResourceService">
<property name="servletPath" value="/admin-console" />
</bean>
<bean id="parameterUnpackerFilter" class="org.springframework.batch.admin.web.filter.ParameterUnpackerFilter">
<property name="prefix" value="unpack_"/>
<property name="putEmptyParamsInPath" value="true"/>
</bean>
</beans>
残念ながら、アプリケーションは、[ジョブと実行] メニューに接続されているフリー マーカー テンプレート (*.ftl ファイル) を読み込むことができないため、どのメニューも使用できません。私が話している ftl ファイルは、spring-batch-admin-manager ソース コードの src/main/resources/org/springframework/batch/admin/web/manager フォルダーの下にあります。