Karaf 4.3.6

I would like to include a Map in a json configuration file.  Following the 
example in 
http://nanthrax.blogspot.com/2020/11/what-new-in-apache-karaf-430_9.html, I 
created the etc/foo.json. Unfortunately the returned type of the property 
"complex" was java.lang.String instead of the expected Map type.

Can a configuration property be a Map?
   If so, please include an example.


***
* etc/foo.json saved
***
{
  "complex":"{
    "a":1,
    "b":"two"
  }
}

***
* etc/foo.json rewritten by Karaf
***
{
  "complex":"{\"a\":1,\"b\":\"two\"}"
}

***
* Snippet to display the property type
***
    @Activate
    protected void activate(final Map<String, Object> configProperties) throws 
Exception {
        for (Entry<String,Object> entry : configProperties.entrySet()) {
            logger.info("Key : {}, Value {}", entry.getKey(), 
entry.getValue().getClass().getCanonicalName());
        }
    }


Paul Spencer

Reply via email to