Hi Stephan,
This worked fine, thanks a lot !
Regards,
Khadija
On 05/21/2013 11:08 AM, Siano, Stephan wrote:
Hi,
The properties file part depends on the felix file installer as it is
configured in karaf. You can use and configure the file installer on
other OSGi servers the same way (I have done this on equinox) or you
have to set your config admin properties by other means.
The blueprint property placeholder requires aries-blueprint-cm (and of
course the config admin service), so it's not specific to karaf.
Best regards
Stephan
*From:*FERJANI [mailto:[email protected]]
*Sent:* Dienstag, 21. Mai 2013 10:20
*To:* Martin Lichtin
*Cc:* [email protected]
*Subject:* Re: Dynamic configuration of datasource
Hello Martin,
Is this a karaf solution ? because I can't use karaf for my example :(
Regards,
Khadija
On 05/20/2013 08:21 PM, Martin Lichtin wrote:
Yould could do
<blueprint>
<cm:property-placeholder id="p"
persistent-id="my.persistent.id.jdbc.mysql">
<cm:default-properties>
<cm:property name="database" value="user" />
<cm:property name="server" value="localhost" />
<cm:property name="port" value="3306" />
<cm:property name="user" value="root" />
<cm:property name="password" value="root" />
</cm:default-properties>
</cm:property-placeholder>
<bean id="dataSource"
class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource">
<property name="url"
value="jdbc:mysql://${server}:${port}/${database}/>
<property name="user" value="${user}" />
<property name="password" value="${password}" />
</bean>
</blueprint>
The defaults can be overridden with a
etc/my.persistent.id.jdbc.mysql.cfg properties file.
Martin
On 20/05/2013 18:26, FERJANI wrote:
Hello everyone,
I developed an example that uses JPA to persist some data.
Right know, here is the configuration of my datasource
<blueprint>
[...]
<bean id="dataSource"
class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource">
<property name="url"
value="jdbc:mysql://localhost:3306/user />
<property name="user" value="root" />
<property name="password" value="root" />
</bean>
[...]
</blueprint>
I'd like to dynamically set the different values (with a
configuration service maybe ?) and I don't know how to do it.
Best regards,
Khadija