diff --git a/docs/src/docbkx/reference/bootstrap.xml b/docs/src/docbkx/reference/bootstrap.xml index 8bea260a..06dd914e 100644 --- a/docs/src/docbkx/reference/bootstrap.xml +++ b/docs/src/docbkx/reference/bootstrap.xml @@ -118,59 +118,59 @@ In its simplest form, a cache can be defined in one line: - - - - - - - - - -]]> - - - - - Spring GemFire namespace - - - - + ]]> - Here, the default-cache will try to connect to + The declaration above declares a bean(CacheFactoryBean) + for the GemFire Cache, named gemfire-cache. All the other SGF components use this + naming convention if no name is specified, allowing for very concise configurations. The definition above will try to connect to an existing cache and, in case one does not exist, create it. Since no additional properties were specified the created cache uses the default - cache configuration. - - Especially in environments with opened caches, this basic - configuration can go a long way. For scenarios where the cache needs to be + cache configuration.Especially in environments with opened caches, this basic + configuration can go a long way. + + For scenarios where the cache needs to be configured, the user can pass in a reference the GemFire configuration file: - <bean id="cache-with-xml" class="org.springframework.data.gemfire.CacheFactoryBean"> - <property name="cacheXml" value="classpath:cache.xml"/> -</bean> - + ]]> + In this example, if the cache needs to be created, it will use the file named cache.xml located in the classpath root. - Only if the cache is created will the configuration file be used. + Only if the cache is created will the configuration file be used. + + Note that the configuration makes use of Spring's Resource abstraction to locate the file. This allows various search patterns to be used, depending on the running environment or the prefix specified (if any) by the value. - In addition to referencing an external configuration file one can + + + In addition to referencing an external configuration file one can specify GemFire settings directly through Java Properties. This can be quite handy when just a few - settings need to be changed: + settings need to be changed. + + To setup properties one can either use the properties element inside the util namespace + to declare or load properties files (the latter is recommended for externalizing environment specific settings outside the application + configuration): + + + + + + +]]> + + Or can use fallback to a raw <beans> declaration: + <bean id="cache-with-props" class="org.springframework.data.gemfire.CacheFactoryBean"> <property name="properties"> <props> @@ -179,27 +179,9 @@ </property> </bean> - So far our examples relied on the primary Spring namespace - (beans). However one is free to add other namespaces to - simplify or enhance the configuration. Let's do the same thing to the - configuration above by using the util namespace and - externalize the properties from the configuration which is a best - practice. - - <?xml version="1.0" encoding="UTF-8"?> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:util="http://www.springframework.org/schema/util" - xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd - http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> - - <bean id="cache-with-props" class="org.springframework.data.gemfire.CacheFactoryBean"> - <property name="properties"> - <util:properties location="classpath:/deployment/env.properties"/> - </property> - </bean> -</beans> - + In this last example, the SGF classes are declared and configured directly without relying on the namespace. As one can tell, + this approach is a generic one, exposing more of the backing infrastructure. + It is worth pointing out again, that the cache settings apply only if the cache needs to be created, there is no opened cache in existence otherwise the existing cache will be used and the configuration will