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

The Archive Base Latest Questions

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

In my webapp which is deployed in tomcat environment, I have one spring configuration

  • 0

In my webapp which is deployed in tomcat environment, I have one spring configuration file which contains placeHolder, like ${myurl}. To replace the placeholder, I created applicationContext.xml in WEB-INF directory which contains a PropertyPlaceholderConfigurater bean and set its location to a properties file which also inside WEB-INF directory.

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="
http://www.springframework.org/schema/beans    
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="placeHolderConfigurer"
  class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
  <property name="location" value="WEB-INF/my.properties"/>
 </bean>
  <import resource="classpath*:META-INF/springFile1.xml"/>
</beans>

Then in web.xml, I specify the context:

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml
    </param-value>
</context-param>

In WEB-INF/my.properties
myurl=http://www.google.com

This is the springFile1.xml

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans    
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

<bean id="placeholderConfig"
    class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="placeholderPrefix" value="${" />
    <property name="placeholderSuffix" value="}" />
</bean>
<bean id="mycache" class="com.abc.MyURL"
    init-method="start" destroy-method="stop">

    <constructor-arg value="${myurl}" />
</bean>
</beans>

I keep getting the unparsed value ${myurl}

I tried to put properties file in classpath, absolute path, and WEB-INF, all result the same.

Any suggestions? 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-05-20T02:37:59+00:00Added an answer on May 20, 2026 at 2:37 am

    Instead of listing the xml files in web.xml, try importing them in applicationContext.xml:

    <import resource="classpath*:springFile1.xml"/>
    

    Update: It appears you are redefining the placeholder configurer in the child xml, thus overriding the one from the parent, which specifies the target properties file. Remove the configurer declaration from the child xml.

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

Sidebar

Related Questions

I have a webapp from which I'd like to insert diagrams and images quickly
I have a small Spring MVC webapp (which embeds ActiveMQ) that is designed to
I have a webapp which resizes its window to exactly fit its contents: window.resizeTo(200,300)
I would like to create a database backed interactive AJAX webapp which has a
I have two web application which are deployed in the same J2EE Application server.
The Spring configuration I am using contains the definition of a persistenceUnitPostProcessor within my
I have a python webapp which accepts some data via POST. The method which
I'm trying to add a very simple file input to my webapp which I'm
I have a maven war project which produces webapp.war, and a maven 'skin' project
I have a Erlang webapp, based on Mochiweb and Mnesia, which consumes and emits

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.