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 9138803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:18:16+00:00 2026-06-17T09:18:16+00:00

I have a spring MVC web application that has the following structure: myapp |-META-INF

  • 0

I have a spring MVC web application that has the following structure:

myapp
    |-META-INF
    |-WEB-INF
        |-classes
        |   |-conf
                |-application.properties
        |-lib
        |   |-externalApp.jar
        |       |-conf
        |           |-applicationContext.xml
        |
        |-applicationContext.xml
        |-myapp-servlet.xml

In myapp/WEB-INF/applicationContext, i imported the applicationContext.xml file that is in the jar file as shown below:

<import resource="classpath:WEB-INF/conf/applicationContext.xml" /> 

The beans in the imported resource work fine and i can see them in my web application’s controller/service classes.

The problem i have is that the
context file in the jar file (i.e. WEB-INF/lib/externalApp.jar/applicationContext.xml) has configuration for loading a properties file. The properties have to be set by the web application so the properties file is in the webapp. The configuration in the jar file’s context file looks like this:

I want the above property to load the property file that is in the web application so i set its value to be as shown below:

<bean class="com.myapp.ExternalAppPropertyPlaceholderConfigurer">
        <property name="location" value="classpath:conf/application.properties" />
        <property name="ignoreUnresolvablePlaceholders" value="true" />
</bean>

With the above setting, the classes in the jar file that expect these properties to be availbe still cant get access to the properties.

The question i guess is how can i get the properties file that is in WEB-INF/classes/conf/application.properties to be accessible to the objects in the jar file that is located in WEB-INF/lib/externalApp.jar.

Looking at the stack traces i am getting, it looks as though the objects referred in the imported context file are loaded first before the properties are loaded which is not i want.

Thanks.

  • 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-06-17T09:18:17+00:00Added an answer on June 17, 2026 at 9:18 am

    You can use the classpath*: prefix like this

    <bean class="com.myapp.ExternalAppPropertyPlaceholderConfigurer">
        <property name="location" value="classpath*:conf/application.properties" />
        <property name="ignoreUnresolvablePlaceholders" value="true" />
    </bean>
    

    EDIT

    Since your conf/application.properties is in your web app, you must define it in your web-app applicationContext (not in the jar as you do now). And define it before importing the applicationContext of your jar. i.e. put something like this in your web-app applicationContext:

    <bean class="com.myapp.ExternalAppPropertyPlaceholderConfigurer">
        <property name="location" value="classpath:conf/application.properties" />
        <property name="ignoreUnresolvablePlaceholders" value="true" />
    </bean>
    <import resource="classpath*:/conf/applicationContext.xml" />
    

    and remove the declaration of the properties from your jar applicationContext.

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

Sidebar

Related Questions

I have a localized spring mvc based web application, that has an externalized messages
I have a Spring Web MVC application that I'd like to serve a large,
I have configured in following way that spring MVC app using Spring 3.1.1.RELEASE web.xml
Say I have an application with the following structure. // ASP.NET MVC (Web Project)
I'm creating a web application using spring mvc. I have started to incorporate the
I am new to Spring MVC . I have a web application. I have
I have a spring web app that uses Hibernate and Velocity. It's an MVC
I'm trying to make this 2-player web game application using Spring MVC. I have
I am using Spring Web MVC for my application. I have 1 dropdown list
I have a java web application based on Spring MVC. The task is to

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.