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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:07:54+00:00 2026-06-06T15:07:54+00:00

I have configured the loading of the properties file as shown below (Spring 3.1)

  • 0

I have configured the loading of the properties file as shown below (Spring 3.1)

my-spring-xml

<context:component-scan base-package="com.mypackage"/>
<context:property-placeholder location="file:///C:/temp/application.properties"/>

web.xml

<context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>       
        /WEB-INF/my-spring-xml
        </param-value>
    </context-param>

application.properties

expirationOffset = 777

In my java class i have declared the property as follows:

private @Value("${expirationOffset}") String propertyValue;

For some reason the value is not being initialised. When i run the following statement:

System.out.println("VALUE - " + propertyValue);

The output is always

16:03:02,355 INFO  [stdout] (http--127.0.0.1-8080-1) VALUE - ${expirationOffset}

I have tried to move the properties file in to the war file to try and access it while it is in the classpath but still the same problem. Here is how i access it from the classpath.

<context:property-placeholder location="classpath:/conf/application.properties"/>

Ideally i would like to keep the properties file outside the war file as i would not want to have to rebuild the war file because of a simple property change.

Have i missed something?

Edit

I removed the msm-spring.xml initialisation paramters from this context:

<context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>       
            /WEB-INF/my-spring-xml
            </param-value>
        </context-param>

and moved it to the servlet context as shown below.

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

    <servlet>
        <servlet-name>myservice</servlet-name>
        <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>
            /WEB-INF/my-spring-xml
            </param-value>          
        </init-param>
    </servlet>

The above change seems to have fixed as i am now getting the correct value. I thought the way i had originally was that i had it on the application context meaning that it will be available throughout the application/webapp.

What is the difference in having the msm-spring in the either of 3 i have listed above?

  • 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-06T15:07:55+00:00Added an answer on June 6, 2026 at 3:07 pm

    This is a bit of speculation based on the information you have provided:

    You probably don’t have the <context:property-placeholder.. in your Root Web Application context – the one loaded by ContextLoaderListener, instead you may be having it in the web context(loaded by Dispatcher servlet). Can you please confirm this.

    Update: Based on the comment, the issue seems to have been that the <context:propert-placeholder.. was defined in the Root Web application context, but being referred to in a component from Web Context.

    The fix is to move the propertyplaceholder to the web context (one defined through MessageDispatcherServlet) in this case.

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

Sidebar

Related Questions

I have configured in following way that spring MVC app using Spring 3.1.1.RELEASE web.xml
I have the following filters configured in my pom.xml: <build> ... <filters> <filter>build.properties</filter> <filter>user.properties</filter>
I have simple java project with structure: package com.abc: a.java b.java c.properties I have
I have configured Plone with the following buildout (via http://build.pythonpackages.com/buildout/plone/4.2.x ): [buildout] allow-hosts =
using Tomcat 6.0 I have configured CollapseComponent in solrconfig.xml but am getting a error
I have installed and configured Fancybox 2 on this page: http://southernlivingplants.com/carmen_johnston/ The first video
I have a NAT configured to run when loading up my favorite Linux distribution
I am trying out a simple spring web service application. I have configured the
I have configured the maven-sql plugin to execute the insert and delete scripts for
I have configured Mod Security on Apache 2.2.21 and i have successfully configured Mod

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.