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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:31:48+00:00 2026-05-30T07:31:48+00:00

I am using Apache Commons Configuration to read a properties file, and I am

  • 0

I am using Apache Commons Configuration to read a properties file, and I am perfectly able to do variable interpolation, and also to retrieve multi-valued properties as a list. However, I haven’t been able to correctly load a property which has several values, where one of them is a reference (variable interpolation) to another multi-valued property.

Here’s an example of my properties file (I have also tried using comma-separated syntax):

doc.mime=application/msword
doc.mime=application/vnd.openxmlformats-officedocument.wordprocessingml.document
doc.mime=${office.mime}

office.mime=application/x-tika-msoffice
office.mime=application/x-tika-ooxml

And how I read from it:

Configuration config = new PropertiesConfiguration("myFile");
final String[] mimesArray = config.getStringArray("doc.mime");
for(String mime : mimesArray) System.out.println(mime);
final List<Object> mimesList = config.getList("doc.mime");
System.out.println(mimesList);

This is the content I get with either method (getStringArray and getList):

[application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/x-tika-msoffice]

This is different from what I expected: the complete contents of both doc.mime and office.mime

Does anyone know if it is possible to interpolate the whole list of values in my other list? And if so, how is it done?

  • 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-30T07:31:50+00:00Added an answer on May 30, 2026 at 7:31 am

    What Commons Configuration does

    As you found out: When interpolating a multi-valued property Commons Configuration will only resolve the first value of that property. See the code at AbstractConfiguration#resolveContainerStore() line 1177.

    I found some related issues:

    CONFIGURATION-28: Someone wants (and gets) the exact opposite of what you want: Only the first value in a multi-valued property.

    CONFIGURATION-55: More discussion about interpolation of multi-valued properties:

    there is probably no correct solution to this problem because the
    expected results strongly depend on a concrete use case

    Workaround: Combine the two lists in code

    Definitely easier than customizing interpolation:

    List<Object> mimesList = config.getList("doc.mime");
    List<Object> officeList = config.getList("office.mime");
    mimesList.addAll(officeList);
    System.out.println(mimesList);
    

    Raise this issue with the Commons Configuration project

    Changing the whole variable interpolation system is probably difficult. But they could at least clarify the documentation.

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

Sidebar

Related Questions

I am using Apache Commons IO FileUtils utility to read a file into a
I'm using Apache Commons Configuration library to store my app properties. I can monitor
I'm using Apache Commons Logging and SLF4J with log4j, but I also want to
I am processing an xml file using apache.commons.digester The xml is, for instance, structured
I'm using the Apache Commons Configuration. How can I get directly a String of
I have a main conf file which I load using apache common configuration class.
I'm trying to use Apache Commons Configuration and using ant for my build tool.
I'm using the apache commons configuration XMLConfiguration object with the XPATH expression engine to
I am using Apache Commons Email library to send emails, but I am not
I'm using Apache Commons e-mail validator and it refuses to accept email address like:

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.