Spring XML files outside WEB-INF

I am working in a maven2 multi-module project using Spring and GWT. Let's say I have two subprojects: service and presentation. The “service” contains the actual implementations of the services, and the “presentation” is responsible for packaging them for the GWT.

I have successfully downloaded Spring XML files that are in the WEB-INF directory (same as web.xml), but I am having problems with these XML files that need to be loaded from other modules.

My web.xml is as follows:

<listener>
    <listener-class>
        org.springframework.web.context.ContextLoaderListener
    </listener-class>
</listener>

 <context-param>
     <param-name>contextConfigLocation</param-name>
     <param-value>
      classpath:/spring-presentation.xml, classpath:/spring-services.xml
     </param-value>
 </context-param>

Here spring-presentation.xmlis in the presentation project, and spring-services.xmlin the service project. The file spring-services.xmldoes not load. Did I miss something?

+3
source share
3 answers

, WAR, JAR. , .

spring-services.xml pom project services, , , /WEB-INF/lib, Spring .

+2

classpath:, WEB-INF/, , WEB-INF/classes jar WEB-INF/lib/.

WEB-INF/, , :

<param-value>
  /WEB-INF/spring-presentation.xml
  /WEB-INF/spring-services.xml
</param-value>

( , , )

+1

<import resource="classpath:spring-services.xml" />

at the top spring-presentation.xmlinstead of linking to it from web.xml

0
source

Source: https://habr.com/ru/post/1755360/


All Articles