cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Roberts <i.robe...@dcs.shef.ac.uk>
Subject Re: Runtime CXF configuration WITHOUT using Spring
Date Fri, 12 Dec 2008 12:00:19 GMT
Steve Cohen wrote:
> But I don't completely understand yet.  Okay, let's say I make the small
> step of putting the PropertyPlaceHolderConfigurer into my cxf.xml
> file.   How does the PropertyPlaceHolderConfigurer know where to find my
> config.properties files?  We get into these chicken and egg problems. 

The location is set in the <bean> block that sets up the configurer
within cxf.xml:

   <bean id="propertyConfigurer"

class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
       <property name="locations">
           <list>
               <value>classpath:config.properties</value>
           </list>
       </property>
   </bean>

classpath:config.properties means it looks for config.properties on your
classpath (i.e. in WEB-INF/classes).  You could put an absolute file URL
in there instead (file:///home/me/config.properties) if you want it to
load from a fixed location rather than from inside your webapp.

It's also worth noting that a PropertyPlaceholderConfigurer will use
Java system properties if it can't find the relevant entry in
config.properties, i.e. if you have a ${webservice.username} placeholder
in your cxf.xml but no webservice.username=blah in config.properties
then it will look at the Java system property with the same name.  If
you *only* want to resolve system properties and not bother with
config.properties at all then you could just use:

<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
/>

Ian

-- 
Ian Roberts               | Department of Computer Science
i.roberts@dcs.shef.ac.uk  | University of Sheffield, UK

Mime
View raw message