karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grzegorz Grzybek <gr.grzy...@gmail.com>
Subject Re: How to inject java.util.Properties in Bean
Date Wed, 24 May 2017 12:08:06 GMT
Hello

You can always do something like this:

public class PropertiesFactory {
    public static Properties createProperties(String filename) {
        Properties result = new Properties();
        result.load(...);
        return result;
    }
}

<bean id=”properties” class=“xxx.PropertiesFactory”
factory-method=“createProperties”>
    <argument value=”filename”/>
</bean>

regards
Grzegorz Grzybek

2017-05-24 9:23 GMT+02:00 ashgonline <ashgonline@gmail.com>:

> Hello,
> I am new to the blueprint.
> I have one requirement where one of the bean object will take a java
> property bundle as its arguement (constructor).
> Not sure the syntax of the same in the buleprint.xml.
> I can understand that there is a way to define the porperty placeholder,but
> that does not solve the problem as it allows to fetch individual propeties
> in a config file.However the requyirement to load the bundle from  a file
> path and inject the same to the bean in its constructor.
>
>
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.
> com/How-to-inject-java-util-Properties-in-Bean-tp4050428.html
> Sent from the Karaf - Dev mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message