I have multiple XML configs.
struts.xml
<struts>
<include file="struts-user.xml" />
<package name="baseInterceptors" extends="struts-default">
<interceptor name="...">
...
</interceptor>
...
</package>
<package name="default" extends="struts-default,baseInterceptors">
<action name="...">
...
</action >
...
</package>
</struts>
struts-user.xml
<struts>
<package name="user" extends="struts-default,baseInterceptors">
<action name="...">
...
</action >
...
</package>
</struts>
But the interceptors from baseInterceptors are not available in struts-user.xml. How can I solve this problem?
Configuration files are processed in order: The
<include>is processed before thebaseInterceptorsanddefaultpackages are processed (read: defined).In other words, the included file depends on pacakges that are not yet defined.
The package configuration docs explain this in a note near the top with an exclamation point next to it.
Unrelated, but you’ve duplicated some configuration, which is misleading/uncommunicative:
baseInterceptorsalready extendsstruts-default, so there’s no need to extend both. Consider creating something like anapplication-defaultpackage so it’s obvious everything in the app should extend from it. This eliminates unnecessary duplication and communicates your intent.