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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:56:43+00:00 2026-05-27T10:56:43+00:00

I’m working on a Spring webapp and I have a library I include as

  • 0

I’m working on a Spring webapp and I have a library I include as a jar file. That library uses Spring annotations, and it has its own context file which is referenced in my webapp’s contextConfigLocation context parameter. The library has its own properties file, loaded through <context:property-placeholder ... />, the values of which are used in the library’s code via the @Value annotation.

I was able to use the library in my webapp until I added a properties file to my webapp via the same mechanism (i.e. <context:property-placeholder... ). All of a sudden I started getting an exception stating “could not resolve placeholder”, the placeholder being the first one referenced in my library’s code.

I spent hours trying to puzzle this out, reading questions, docs, code and finally came across a bit of sample code that was doing what I was trying to do: set up a Spring-managed library that loaded properties from an external file. The snippet showing the loading of the property file held the solution to my problem, but there was no explanation as to why it worked. In the library’s application context I had to reference the property file like this:

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
  <property name="locations" value="classpath:my/package/config/app-lib.properties" />
  <property name="placeholderPrefix" value="$app-lib{" />
</bean>

I’m happy my code is working again but I’m not completely satisfied because I don’t understand what’s going on. This question is similar (I’d missed the significance of it while searching for an answer) but the answer doesn’t say why using a placeholderPrefix is necessary.

Can someone explain why my library wasn’t able to find its properties until I customized the prefix?

  • 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-27T10:56:44+00:00Added an answer on May 27, 2026 at 10:56 am

    Normally, you can only have one PropertyPlaceholderConfigurer, and it is responsible for processing all property placeholders.

    Since the library that you are using apparently already sets up a PropertyPlaceholderConfigurer, yours was clashing with the one from the library, which was set up to read the library’s property file, not your application’s.

    By setting a different placeholderPrefix, you are allowing the two PropertyPlaceholderConfigurer instances to co-exist, with the library’s instance processing ‘normal’ property placeholders (ones with the default prefix of “${“, and your application’s instance processing the the custom placeholders with the prefix of “$app-lib{“.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I have a reasonable size flat file database of text documents mostly saved in
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
In my XML file chapters tag has more chapter tag.i need to display chapters
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.