14.5 Property Placeholder Configuration - Reference Documentation
Authors: Graeme Rocher, Peter Ledbrook, Marc Palmer, Jeff Brown, Luke Daley, Burt Beckwith
Version: null
14.5 Property Placeholder Configuration
Grails supports the notion of property placeholder configuration through an extended version of Spring's PropertyPlaceholderConfigurer, which is typically useful in combination with externalized configuration.Settings defined in either ConfigSlurper scripts or Java properties files can be used as placeholder values for Spring configuration ingrails-app/conf/spring/resources.xml. For example given the following entries in grails-app/conf/Config.groovy (or an externalized config):database.driver="com.mysql.jdbc.Driver" database.dbname="mysql:mydb"
resources.xml as follows using the familiar ${..} syntax:<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName"> <value>${database.driver}</value> </property> <property name="url"> <value>jdbc:${database.dbname}</value> </property> </bean>

