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

  • Home
  • SEARCH
  • 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 409805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:49:35+00:00 2026-05-12T17:49:35+00:00

I want to fill a bean list property using Spring properties place holder. Context

  • 0

I want to fill a bean list property using Spring properties place holder.

Context file

<bean name="XXX" class="XX.YY.Z">
      <property name="urlList">
            <value>${prop.list}</value>
      </property>
</bean>

Properties File

prop.list.one=foo
prop.list.two=bar

Any help would be much appreciated

  • 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-12T17:49:36+00:00Added an answer on May 12, 2026 at 5:49 pm

    Use a util:properties element to load your properties. You can use PropertyPlaceholderConfigurer to specify the path to your file:

    <bean name="XXX" class="XX.YY.Z">
      <property name="urlList">
        <util:properties location="${path.to.properties.file}"/>
      </property>
    </bean>
    

    Update I’ve misunderstood the question; you only want to return properties where key starts with specific string. The easiest way to achieve that would be to do so within setter method of your bean. You’ll have to pass the string to your bean as a separate property. Extending the above declaration:

    <bean name="XXX" class="XX.YY.Z" init-method="init">
      <property name="propertiesHolder">
         <!-- not sure if location has to be customizable here; set it directly if needed -->
        <util:properties location="${path.to.properties.file}"/>
      </property>
      <property name="propertyFilter" value="${property.filter}" />
    </bean>
    

    In your XX.YY.Z bean:

    private String propertyFilter;
    private Properties propertiesHolder;
    private List<String> urlList;
    
    // add setter methods for propertyFilter / propertiesHolder
    
    // initialization callback
    public void init() {
      urlList = new ArrayList<String>();
      for (Enumeration en = this.propertiesHolder.keys(); en.hasMoreElements(); ) {
        String key = (String) en.nextElement();
        if (key.startsWith(this.propertyFilter + ".") { // or whatever condition you want to check
          this.urlList.add(this.propertiesHolder.getProperty(key));
        }
      } // for
    }
    

    If you need to do this in many different places you can wrap the above functionality into a FactoryBean.

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

Sidebar

Related Questions

I want to fill a map with class name and method, a unique identifier
Using C# and ASP.NET I want to programmatically fill in some values (4 text
I want to fill a DataGridView control using DataAdapter. But I don't know how
I want to fill a table with a list of results. But not sure
I want to fill std::vector (or some other STL container): class Foo { public:
Hello I want to fill an hashmap with value => key :idissue value:arraylist (list
i want to add rows using loop and then want user to fill the
Let's say I have a split view, and I want to fill half of
I want to do something like: MyObject myObj = GetMyObj(); // Create and fill
I want to loop over the contents of a text file and do a

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.