You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Frizz <fr...@googlemail.com> on 2016/02/16 19:18:30 UTC

Set System Property With Blueprint Configuration File

I am trying to set a System Property in my Blueprint Configuration File,
similar to the Spring approach that is described here:
http://stackoverflow.com/questions/3339736/set-system-property-with-spring-configuration-file

My code looks like this:

<bean id="mySysProp"
class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
   <property name = "targetObject" value="#{@systemProperties}" />
   <property name = "targetMethod" value="putAll" />
   <property name = "arguments" />
       <list>
           <value>org.blabla.packages</value>
           <value>*</value>
       <list>
   </property>
</bean>

It doesn't throw an exception or something - but it's not setting the
system property either. What might be the problem?

I am using Apache Karaf 4.0.x (which uses Apache Aries Blueprint).

Re: Re: Set System Property With Blueprint Configuration File

Posted by Martin Lichtin <li...@yahoo.com>.
To access system properties, use for example:

         <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]" />
         <cm:property-placeholder id="placeholder" persistent-id="pid">
                 <cm:default-properties>
                         <cm:property name="userHome" value="$[user.home]" />
                 </cm:default-properties>
         </cm:property-placeholder>

but accessing environment variables is still an open issue: https://issues.apache.org/jira/browse/ARIES-1311

- Martin

On 17.02.2016 10:32, Frizz wrote:
> Do have an example for this?
>
> On Tue, Feb 16, 2016 at 7:20 PM, Jean-Baptiste Onofré <jb@nanthrax.net <ma...@nanthrax.net>> wrote:
>
>     Hi,
>
>     why don't you use directly aries blueprint ext and cm ?
>
>     Regards
>     JB
>
>
>     On 02/16/2016 07:18 PM, Frizz wrote:
>
>         I am trying to set a System Property in my Blueprint Configuration File,
>         similar to the Spring approach that is described here:
>         http://stackoverflow.com/questions/3339736/set-system-property-with-spring-configuration-file
>
>         My code looks like this:
>
>         <bean id="mySysProp"
>         class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
>             <property name = "targetObject" value="#{@systemProperties}" />
>             <property name = "targetMethod" value="putAll" />
>             <property name = "arguments" />
>                 <list>
>         <value>org.blabla.packages</value>
>                     <value>*</value>
>                 <list>
>             </property>
>         </bean>
>
>         It doesn't throw an exception or something - but it's not setting the
>         system property either. What might be the problem?
>
>         I am using Apache Karaf 4.0.x (which uses Apache Aries Blueprint).
>
>
>     -- 
>     Jean-Baptiste Onofré
>     jbonofre@apache.org <ma...@apache.org>
>     http://blog.nanthrax.net
>     Talend - http://www.talend.com
>
>


Re: Set System Property With Blueprint Configuration File

Posted by Frizz <fr...@googlemail.com>.
Do have an example for this?

On Tue, Feb 16, 2016 at 7:20 PM, Jean-Baptiste Onofré <jb...@nanthrax.net>
wrote:

> Hi,
>
> why don't you use directly aries blueprint ext and cm ?
>
> Regards
> JB
>
>
> On 02/16/2016 07:18 PM, Frizz wrote:
>
>> I am trying to set a System Property in my Blueprint Configuration File,
>> similar to the Spring approach that is described here:
>>
>> http://stackoverflow.com/questions/3339736/set-system-property-with-spring-configuration-file
>>
>> My code looks like this:
>>
>> <bean id="mySysProp"
>>
>> class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
>>     <property name = "targetObject" value="#{@systemProperties}" />
>>     <property name = "targetMethod" value="putAll" />
>>     <property name = "arguments" />
>>         <list>
>>             <value>org.blabla.packages</value>
>>             <value>*</value>
>>         <list>
>>     </property>
>> </bean>
>>
>> It doesn't throw an exception or something - but it's not setting the
>> system property either. What might be the problem?
>>
>> I am using Apache Karaf 4.0.x (which uses Apache Aries Blueprint).
>>
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>

Re: Set System Property With Blueprint Configuration File

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

why don't you use directly aries blueprint ext and cm ?

Regards
JB

On 02/16/2016 07:18 PM, Frizz wrote:
> I am trying to set a System Property in my Blueprint Configuration File,
> similar to the Spring approach that is described here:
> http://stackoverflow.com/questions/3339736/set-system-property-with-spring-configuration-file
>
> My code looks like this:
>
> <bean id="mySysProp"
> class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
>     <property name = "targetObject" value="#{@systemProperties}" />
>     <property name = "targetMethod" value="putAll" />
>     <property name = "arguments" />
>         <list>
>             <value>org.blabla.packages</value>
>             <value>*</value>
>         <list>
>     </property>
> </bean>
>
> It doesn't throw an exception or something - but it's not setting the
> system property either. What might be the problem?
>
> I am using Apache Karaf 4.0.x (which uses Apache Aries Blueprint).

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com