diff --git a/docs/src/reference/docbook/reference/bootstrap.xml b/docs/src/reference/docbook/reference/bootstrap.xml
index 4f93e434..1ce9d412 100644
--- a/docs/src/reference/docbook/reference/bootstrap.xml
+++ b/docs/src/reference/docbook/reference/bootstrap.xml
@@ -221,6 +221,10 @@
support,
SpEL and the environment abstraction one
can externalize environment specific properties from the main code base easing the deployment across multiple machines.
+
+ To avoid initialization problems, the CacheServers started by SGF will start after the container has been fully initialized. This
+ allows potential regions, listener, writers or instantiators defined declaratively to be fully initialized and registered before the server starts accepting connections. Keep this in mind
+ when doing programmatic configuration of the items above as the server might start before your components and thus not be seen by the clients connecting right away.
diff --git a/src/main/java/org/springframework/data/gemfire/server/CacheServerFactoryBean.java b/src/main/java/org/springframework/data/gemfire/server/CacheServerFactoryBean.java
index 4e939433..ea800a54 100644
--- a/src/main/java/org/springframework/data/gemfire/server/CacheServerFactoryBean.java
+++ b/src/main/java/org/springframework/data/gemfire/server/CacheServerFactoryBean.java
@@ -34,7 +34,7 @@ import com.gemstone.gemfire.cache.server.ClientSubscriptionConfig;
import com.gemstone.gemfire.cache.server.ServerLoadProbe;
/**
- * FactoryBean for easy creation and configuration of GemFire {@link CacheServerProcess} instances.
+ * FactoryBean for easy creation and configuration of GemFire {@link CacheServer} instances.
*
* @author Costin Leau
*/
@@ -106,8 +106,6 @@ public class CacheServerFactoryBean implements FactoryBean, Initial
config.setEvictionPolicy(evictionPolicy.name().toLowerCase());
if (subscriptionDiskStore != null)
config.setDiskStoreName(subscriptionDiskStore.getFile().getCanonicalPath());
-
- start();
}
public void destroy() {
diff --git a/src/main/java/org/springframework/data/gemfire/server/SubscriptionEvictionPolicy.java b/src/main/java/org/springframework/data/gemfire/server/SubscriptionEvictionPolicy.java
index b8037017..d7c1efda 100644
--- a/src/main/java/org/springframework/data/gemfire/server/SubscriptionEvictionPolicy.java
+++ b/src/main/java/org/springframework/data/gemfire/server/SubscriptionEvictionPolicy.java
@@ -19,7 +19,7 @@ package org.springframework.data.gemfire.server;
import com.gemstone.gemfire.cache.server.CacheServer;
/**
- * Enumeration of the various client subscription policies for {@link CacheServerProcess}.
+ * Enumeration of the various client subscription policies for {@link CacheServer}.
*
* @author Costin Leau
*/
diff --git a/src/test/java/org/springframework/data/gemfire/Init.java b/src/test/java/org/springframework/data/gemfire/Init.java
new file mode 100644
index 00000000..7c873d6a
--- /dev/null
+++ b/src/test/java/org/springframework/data/gemfire/Init.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2011 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.data.gemfire;
+
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.beans.factory.BeanFactoryAware;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.util.Assert;
+
+import com.gemstone.gemfire.cache.server.CacheServer;
+
+
+/**
+ * Simple bean used to check initialization order
+ *
+ * @author Costin Leau
+ */
+public class Init implements InitializingBean, BeanFactoryAware {
+
+ private BeanFactory bf;
+
+ public void afterPropertiesSet() {
+ CacheServer cs = bf.getBean(CacheServer.class);
+ Assert.isTrue(!cs.isRunning(), "CacheServer should not have been started yet... ");
+ }
+
+ public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
+ this.bf = beanFactory;
+ }
+}
diff --git a/src/test/java/org/springframework/data/gemfire/config/CacheServerNamespaceTest.java b/src/test/java/org/springframework/data/gemfire/config/CacheServerNamespaceTest.java
index 1148c3d0..023d5750 100644
--- a/src/test/java/org/springframework/data/gemfire/config/CacheServerNamespaceTest.java
+++ b/src/test/java/org/springframework/data/gemfire/config/CacheServerNamespaceTest.java
@@ -35,6 +35,11 @@ public class CacheServerNamespaceTest extends RecreatingContextTest {
return "org/springframework/data/gemfire/config/server-ns.xml";
}
+ @Test
+ public void testInitOrder() throws Exception {
+ // the test is actually executed through Init#afterPropertiesSet
+ }
+
@Test
public void testBasicCacheServer() throws Exception {
CacheServer cacheServer = ctx.getBean("advanced-config", CacheServer.class);
diff --git a/src/test/resources/org/springframework/data/gemfire/config/server-ns.xml b/src/test/resources/org/springframework/data/gemfire/config/server-ns.xml
index a03427d6..fb176f23 100644
--- a/src/test/resources/org/springframework/data/gemfire/config/server-ns.xml
+++ b/src/test/resources/org/springframework/data/gemfire/config/server-ns.xml
@@ -5,7 +5,6 @@
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
- default-lazy-init="true"
xsi:schemaLocation="http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
@@ -13,6 +12,8 @@
+
+
+
+