3

Consider 2 property files:

  1. abc.properties
  2. bcd.properties

I need to get Strings from abc.properties in bcd.properties. Using CompositeConfiguration I got solution but its not a generic solution in my project.Please suggest a way to do it using ResourceBundle itself.

Sharing what I have done :

ResourceBundle  inStream = ResourceBundle.getBundle("bcd", Locale.US); 
  Properties test = new Properties();
  String keys = inStream.getString("Email");
  System.out.println("Result here "+keys);
        
abc.properties : 
  Email=Not a valid email address

bcd.properties : 
  include = abc.properties
  //some strings

Hope you got my issue. Thanks in advance!

Javier Parra
  • 2,020
  • 2
  • 18
  • 32
Prajith C
  • 31
  • 1
  • can you check this? https://stackoverflow.com/questions/872272/how-to-reference-another-property-in-java-util-properties – Abhilash Sep 03 '20 at 21:54
  • Hi Abhilash,this example show variable interpolation in same properties file. I need it from different property file.Thanks – Prajith C Sep 04 '20 at 03:27

0 Answers0