Never mind.

I found 
https://osgi.org/specification/osgi.cmpn/7.0.0/service.configurator.html which 
matches the observed behavior.

Paul Spencer



> On May 15, 2022, at 3:18 PM, Paul Spencer <[email protected]> wrote:
> 
> 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