4 Replies Latest reply on Nov 12, 2012 10:10 AM by davsclaus

    How to access system property in blueprint xml?

    jasonnh

      Hi,

       

      I have a camel context and beans defined in a blueprint xml file and would like to access a system property.

       

      I would like the blueprint equivalent of spring:

       

      ${com.company.myProperty}

       

      e.g.

       

       

       

      Does anybody know of a way of doing this in blueprint?

       

      Many thanks.

        • 1. Re: How to access system property in blueprint xml?
          ffang

          Hi,

           

          To use system properties in Blueprint, you should use blueprint-ext.

           

          something like:

           

           

           

          Freeman

          • 2. Re: How to access system property in blueprint xml?
            jasonnh

            Thanks Freeman.

             

            Do you know how can I combine that with getting other properties from a properties file on the classpath to be used in a camel context?

             

            The following works without the ext:property-placeholder but not combined with it - it fails to find the camelProperty property (defined in some.properties file).  Trying to use classpath: prefix in location tag of ext:property-placeholder does not work either.

             

            Any ideas much appreciated.

             

            e.g.:

             

             

             

            Edited by: jasonnh on Aug 10, 2012 11:24 AM

            • 3. Re: How to access system property in blueprint xml?
              jasonnh

              My original question has been answered - thanks again.

               

              In case this can help someone I think the problem I am having with mixing property placeholders is a bug that is fixed in camel 2.10.0 (undocumented in the release notes), i.e.:

               

              BlueprintPropertiesPlaceholder.parseProperty method has changed.  Basically, 2.9.0 uses a parameter called 'value' as a local variable which gets set to null and then passes that to delegate.parseProperty as if it was unchanged.  2.10.0 declares a separate local variable 'answer' and then passes the orignal 'value' to delegate.parseProperty.

              • 4. Re: How to access system property in blueprint xml?
                davsclaus

                I have logged a ticket to get this backported to Fuse 7.0.x

                http://fusesource.com/issues/browse/MR-673