Polish samples and associated docs.
This commit is contained in:
@@ -150,7 +150,9 @@ the creation of a peer cache instance along with a `CacheServer` for cache clien
|
||||
server-side `Region` (by default, "_ClusteredSpringSessions_") used to store the `HttpSessions` state. This step is
|
||||
optional since the Session `Region` could be created manually, perhaps using external means.
|
||||
Using `@EnableGemFireHttpSession` is convenient.
|
||||
<3> Finally, we adjust the port that the `CacheServer` will use to listen for cache clients by declaring
|
||||
<3> (Optional) We annotate the `Config` class with `@EnableManager` to start an embedded Apache Geode Manager
|
||||
service to allow JMX clients (e.g. Apache Geode's _Gfsh_ shell tool) to connect and inspect the server.
|
||||
<4> Finally, we adjust the port that the `CacheServer` will use to listen for cache clients by declaring
|
||||
a `CacheServerConfigurer` bean to modify the SDG `CacheServerFactoryBean` using property placeholders.
|
||||
|
||||
The sample makes use of _Spring's_ `PropertySourcesPlaceholderConfigurer` in order to externalize the sample
|
||||
|
||||
@@ -89,7 +89,7 @@ include::{samples-dir}javaconfig/gemfire-p2p/src/main/java/sample/Config.java[ta
|
||||
the creation of a peer cache instance.
|
||||
<2> Then, the `Config` class is annotated with `@EnableGemFireHttpSession` to create the necessary server-side `Region`
|
||||
(by default, "_ClusteredSpringSessions_") used to store the `HttpSessions` state.
|
||||
<3> (Optionally) Finally, we annotated the `Config` class with `@EnableManager` to start an embedded Apache Geode Manager
|
||||
<3> (Optional) Finally, we annotated the `Config` class with `@EnableManager` to start an embedded Apache Geode Manager
|
||||
service to allow JMX clients (e.g. Apache Geode's _Gfsh_ shell tool) to connect and inspect the server.
|
||||
|
||||
NOTE: For more information on configuring _Spring Data Geode, refer to the
|
||||
|
||||
@@ -24,11 +24,13 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
||||
import org.springframework.data.gemfire.config.annotation.CacheServerApplication;
|
||||
import org.springframework.data.gemfire.config.annotation.CacheServerConfigurer;
|
||||
import org.springframework.data.gemfire.config.annotation.EnableManager;
|
||||
import org.springframework.session.data.gemfire.config.annotation.web.http.EnableGemFireHttpSession;
|
||||
|
||||
// tag::class[]
|
||||
@CacheServerApplication(name = "SpringSessionSampleJavaConfigGemFireClientServer", logLevel = "error") // <1>
|
||||
@EnableGemFireHttpSession(maxInactiveIntervalInSeconds = 30) // <2>
|
||||
@EnableManager(start = true) // <3>
|
||||
public class ServerConfig {
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
@@ -44,7 +46,7 @@ public class ServerConfig {
|
||||
|
||||
@Bean
|
||||
CacheServerConfigurer cacheServerPortConfigurer(
|
||||
@Value("${spring.session.data.geode.cache.server.port:40404}") int port) { // <3>
|
||||
@Value("${spring.session.data.geode.cache.server.port:40404}") int port) { // <4>
|
||||
|
||||
return (beanName, cacheServerFactoryBean) -> {
|
||||
cacheServerFactoryBean.setPort(port);
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.springframework.session.data.gemfire.config.annotation.web.http.Enabl
|
||||
|
||||
// tag::class[]
|
||||
@PeerCacheApplication(name = "SpringSessionSampleJavaConfigGemFireP2p", logLevel = "error") // <1>
|
||||
@EnableGemFireHttpSession // <2>
|
||||
@EnableGemFireHttpSession(maxInactiveIntervalInSeconds = 30) // <2>
|
||||
@EnableManager(start = true) // <3>
|
||||
public class Config {
|
||||
|
||||
|
||||
@@ -21,10 +21,8 @@
|
||||
<util:properties id="gemfireProperties">
|
||||
<prop key="name">SpringSessionSampleXmlGemFireClientServer</prop>
|
||||
<prop key="log-level">${spring.session.data.gemfire.log-level:error}</prop>
|
||||
<!--
|
||||
<prop key="jmx-manager">true</prop>
|
||||
<prop key="jmx-manager-start">true</prop>
|
||||
-->
|
||||
</util:properties>
|
||||
|
||||
<!--2-->
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:gfe="http://www.springframework.org/schema/gemfire"
|
||||
xmlns:p="http://www.springframework.org/schema/p"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="
|
||||
@@ -28,7 +29,8 @@
|
||||
<gfe:cache properties-ref="gemfireProperties" use-bean-factory-locator="false"/>
|
||||
|
||||
<!--3-->
|
||||
<bean class="org.springframework.session.data.gemfire.config.annotation.web.http.GemFireHttpSessionConfiguration"/>
|
||||
<bean class="org.springframework.session.data.gemfire.config.annotation.web.http.GemFireHttpSessionConfiguration"
|
||||
p:maxInactiveIntervalInSeconds="30"/>
|
||||
<!-- end::beans[] -->
|
||||
|
||||
</beans>
|
||||
|
||||
Reference in New Issue
Block a user