apacheosgiblueprintaries

Aries blueprint and system properties


I'd like to get system properties (e.g. username) and pass them as properties to a bean in aries blueprint. Something to pass on a property placeholder default, like username or computername from system properties:

<cm:property-placeholder id="placeholder" persistent-id="config">
        <cm:default-properties>
            <cm:property name="group.password" value="${username}" />
        </cm:default-properties>
    </cm:property-placeholder>

or pass it on to a bean, like this:

<bean id="mapStoreConfig" class="com.acme.mypackage.MyBean">
    <property name="enabledp" value="${username}" />
</bean>

I've searched and searched but can't find any explanation how to do this. Should I use env:username or something like this?


Solution

  • Try this:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" 
        xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0">
    
        <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]" />
    </blueprint>