Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 692807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:41:20+00:00 2026-05-14T02:41:20+00:00

I have a spring-based Web Service. I now want to build a sort of

  • 0

I have a spring-based Web Service. I now want to build a sort of plugin for it that extends it with beans. What I have now in web.xml is:

<context-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>/WEB-INF/classes/*-configuration.xml</param-value>
</context-param>

My core app has main-configuration.xml which declares its beans. My plugin app has plugin-configuration.xml which declares additional beans. Now when I deploy, my build deploys plugin.jar into /WEB-INF/lib/ and copies plugin-configuration.xml into /WEB-INF/classes/ all under main.war.

This is all fine (although I think there could be a better solution), but when I develop the plugin, I don’t want to have two projects in Eclipse with dependencies. I wish to have main.jar that I include as a library. However, web.xml from main.jar isn’t automatically discovered. How can I do this? Bean injection? Bean discovery of some sort? Something else?

Note: I expect to have multiple different plugins in production, but development of each of them will be against pure main.jar

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T02:41:20+00:00Added an answer on May 14, 2026 at 2:41 am

    I think there is a simpler approach:

    In your host application (the webapp) define something like the following contextConfigLocation parameter:

    <context-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>classpath*:/META-INF/foo/*-configuration.xml</param-value>
    </context-param>
    

    The crucial parts are classpath*:as it results in scanning the entire classpath for config files matching the following pattern. If you only use classpath: the lookup will stop at the first file found. It also won’t traverse JARs if not starred correctly.

    The second crucial part is having at least one non-wildcarded basepath for the lookup to work. This is due to Classloader traits that only reliably returns all resources if they contain a base path (see the Javadoc on PathMatchingResourcePatternResolver for details).

    What you now have to do with your plugin projects is place your plugin-configuration.xml in /META-INF/foo/, package that as JAR and place it into your classpath (in case you build with Maven just add the dependency).

    On application start Spring will now also pickup all config files from your plugins and build the ÀpplicationContext` from em.

    You also might wanna checkout another post I did on application modularity with Spring: How do you make a multi-module spring configuration?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WCF web service that returns a string to a Java based
We have a legacy web application (not Spring based) and are looking for best
I have a SOAP based web service running using Apache CXF. I have WS-Addressing
We are currently using Spring MVC to implement REST web services. We now want
I have a Spring framework based Java web application, which has been built in
I have written a SOAP based web service which runs fine on a Tomcat
here's a problem I just stumbled into: I have an php based web service
I have the following web service that allows me uploading files: [WebService(Namespace = http://tempuri.org/)]
I have developed a stack of web Services based on: Spring ws 2.0 with
I'm building a Smalltalk API to an XML-based web service. The XML service is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.