2

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?

Luis Matos
  • 347
  • 3
  • 14

1 Answers1

1

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>
Christian Schneider
  • 19,420
  • 2
  • 39
  • 64
  • Thanks Christian with your help I could do it. Actually I even found it now on internet adding the "placeholder-prefix" to the search. I came up with this: ` ` and the explanation that using this line of code allows blueprint to have access to the system variables. – Luis Matos Oct 05 '14 at 20:29