You can also use spring-dm. I've been using it until we move to K3.

e.g.

<beans xmlns="http://www.springframework.org/schema/beans";
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       xmlns:osgi="http://www.springframework.org/schema/osgi";
       xmlns:osgix="http://www.springframework.org/schema/osgi-compendium";
       xmlns:mvc="http://www.springframework.org/schema/mvc";
       xmlns:context="http://www.springframework.org/schema/context";
       xsi:schemaLocation="http://www.springframework.org/schema/beans
                         
http://www.springframework.org/schema/beans/spring-beans.xsd
                         http://www.springframework.org/schema/osgi
                         
http://www.springframework.org/schema/osgi/spring-osgi.xsd
                         http://www.springframework.org/schema/osgi-compendium
                             
http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
                             http://www.springframework.org/schema/context
                             
http://www.springframework.org/schema/context/spring-context.xsd
                             http://www.springframework.org/schema/mvc
                         
http://www.springframework.org/schema/mvc/spring-mvc.xsd";>


  <osgix:cm-properties id="cmProps" persistent-id="MyWARConfig">
        <!-- default values, overriden by cfg -->
        <prop key="a">12345</prop>
        <prop key="b">67890</prop>
    </osgix:cm-properties>

    <context:property-placeholder properties-ref="cmProps" />

    <bean id="myBean" init-method="init"
          class="org.myBeanImpl">
        <property name="myProperty1" value="${a}"/>
        <property name="myProperty2" value="${b}"/>
    </bean>

....

you can put this in your spring servlet xml.

you can even get a ref to the config admin service...

 <osgi:reference id="configurationAdmin" 
interface="org.osgi.service.cm.ConfigurationAdmin"/>

On Sep 23, 2013, at 4:53 PM, Achim Nierbeck wrote:

> With Pax-Web 3.0 it's possible to use Pax-CDI which lets you inject std. OSGi 
> services into Servlets. 
> 
> Regards, Achim 
> 
> 
> 2013/9/23 Matthew Bishop <[email protected]>
> The short answer is yes, but via gemini blueprint. You can create a bean
> that refers to the service you are trying to configure and add in a
> managed-properties directive to fire a PID change to a method like this:
> 
> <bean id="yourManagedService" class="com.company.YourManagedService.class">
>   <compendium:managed-properties persistent-id="yourPID"
> update-method="updateProperties"/>
>         </bean>
> 
> 
> 
> 
> Compendium's
> schemaLocation="http://www.eclipse.org/gemini/blueprint/schema/blueprint-co
> mpendium
>                         
> http://www.eclipse.org/gemini/blueprint/schema/blueprint-compendium/gemi
> ni-blueprint-compendium.xsd">
> 
> 
> 
> 
> On 2013-09-23 12:49 PM, "Jean-Baptiste Onofré" <[email protected]> wrote:
> 
> >Hi Oli,
> >
> >not sure to follow you. You can always use Spring in your WAR, with a
> >property placeholder which relay to ConfigAdmin.
> >
> >Is it what you are looking for ? I can send you an example if you need.
> >
> >Regards
> >JB
> >
> >On 09/23/2013 09:29 PM, Oliver Wulff wrote:
> >> Hi there
> >>
> >> Is it possible to use the Config Admin service to configure properties a
> >> web application which uses spring and has been deployed using the WAR
> >> deployer?
> >>
> >> Thanks
> >>
> >> Oli
> >>
> >
> >--
> >Jean-Baptiste Onofré
> >[email protected]
> >http://blog.nanthrax.net
> >Talend - http://www.talend.com
> >
> 
> 
> 
> 
> Matthew Bishop, Senior Architect
> Mobile: +1-604-218-8102
> Email: [email protected]
> 
> Elastic Path Software Inc.
> Web: www.elasticpath.com
> Blog: www.getelastic.com
> Community: grep.elasticpath.com
> Careers: www.elasticpath.com/jobs
> 
> Confidentiality Notice: This message is intended only for the use of the 
> designated addressee(s), and may contain information that is privileged, 
> confidential and exempt from disclosure. Any unauthorized viewing, 
> disclosure, copying, distribution or use of information contained in this 
> e-mail is prohibited and may be unlawful. If you received this e-mail in 
> error, please reply to the sender immediately to inform us you are not the 
> intended recipient and delete the email from your computer system. Thank you.
> 
> 
> 
> 
> 
> -- 
> 
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer & 
> Project Lead
> OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home> 
> Commiter & Project Lead
> blog <http://notizblog.nierbeck.de/>

Reply via email to