Add source code Asciidoc tags for reference in the documentation (i.e. user guide).
Resolves Issue #3.
This commit is contained in:
@@ -73,7 +73,7 @@ public class Application {
|
||||
SpringApplication.run(Application.class, args);
|
||||
}
|
||||
|
||||
@ClientCacheApplication(name = "SpringSessionDataGeodeClientWithScopedProxiesBootSample", logLevel = "config",
|
||||
@ClientCacheApplication(name = "SpringSessionDataGeodeClientWithScopedProxiesBootSample",
|
||||
pingInterval = 5000L, readTimeout = 15000, retryAttempts = 1, subscriptionEnabled = true) // <3>
|
||||
@EnableGemFireHttpSession(poolName = "DEFAULT") // <4>
|
||||
static class ClientCacheConfiguration {
|
||||
@@ -130,7 +130,7 @@ public class Application {
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, path = "/counts")
|
||||
public String requestAndSessionInstanceCount(HttpServletRequest request, HttpSession session, Model model) {
|
||||
public String requestAndSessionInstanceCount(HttpServletRequest request, HttpSession session, Model model) { // <7>
|
||||
|
||||
model.addAttribute("sessionId", session.getId());
|
||||
model.addAttribute("requestCount", this.requestBean.getCount());
|
||||
@@ -139,3 +139,4 @@ public class Application {
|
||||
return INDEX_TEMPLATE_VIEW_NAME;
|
||||
}
|
||||
}
|
||||
// end::class[]
|
||||
|
||||
@@ -28,9 +28,10 @@ import org.springframework.web.context.annotation.RequestScope;
|
||||
* @author John Blum
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Component
|
||||
@RequestScope(proxyMode = ScopedProxyMode.TARGET_CLASS)
|
||||
@SuppressWarnings("unused")
|
||||
// tag::class[]
|
||||
@Component // <1>
|
||||
@RequestScope(proxyMode = ScopedProxyMode.TARGET_CLASS) // <2>
|
||||
public class RequestScopedProxyBean {
|
||||
|
||||
private static final AtomicInteger INSTANCE_COUNTER = new AtomicInteger(0);
|
||||
@@ -38,7 +39,7 @@ public class RequestScopedProxyBean {
|
||||
private final int count;
|
||||
|
||||
public RequestScopedProxyBean() {
|
||||
this.count = INSTANCE_COUNTER.incrementAndGet();
|
||||
this.count = INSTANCE_COUNTER.incrementAndGet(); // <3>
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
@@ -50,3 +51,4 @@ public class RequestScopedProxyBean {
|
||||
return String.format("{ @type = '%s', count = %d }", getClass().getName(), getCount());
|
||||
}
|
||||
}
|
||||
// end::class[]
|
||||
|
||||
@@ -29,9 +29,10 @@ import org.springframework.web.context.annotation.SessionScope;
|
||||
* @author John Blum
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Component
|
||||
@SessionScope(proxyMode = ScopedProxyMode.TARGET_CLASS)
|
||||
@SuppressWarnings("unused")
|
||||
// tag::class[]
|
||||
@Component // <1>
|
||||
@SessionScope(proxyMode = ScopedProxyMode.TARGET_CLASS) // <2>
|
||||
public class SessionScopedProxyBean implements Serializable {
|
||||
|
||||
private static final AtomicInteger INSTANCE_COUNTER = new AtomicInteger(0);
|
||||
@@ -39,7 +40,7 @@ public class SessionScopedProxyBean implements Serializable {
|
||||
private final int count;
|
||||
|
||||
public SessionScopedProxyBean() {
|
||||
this.count = INSTANCE_COUNTER.incrementAndGet();
|
||||
this.count = INSTANCE_COUNTER.incrementAndGet(); // <3>
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
@@ -51,3 +52,4 @@ public class SessionScopedProxyBean implements Serializable {
|
||||
return String.format("{ @type = '%s', count = %d }", getClass().getName(), getCount());
|
||||
}
|
||||
}
|
||||
// end::class[]
|
||||
|
||||
@@ -40,10 +40,10 @@ import org.springframework.session.data.gemfire.config.annotation.web.http.Enabl
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
// tag::class[]
|
||||
@SpringBootApplication
|
||||
@CacheServerApplication(name = "SpringSessionDataGeodeServerWithScopedProxiesBootSample", logLevel = "config")
|
||||
@EnableGemFireHttpSession(maxInactiveIntervalInSeconds = 10)
|
||||
@EnableManager(start = true)
|
||||
@SpringBootApplication // <1>
|
||||
@CacheServerApplication(name = "SpringSessionDataGeodeServerWithScopedProxiesBootSample") // <2>
|
||||
@EnableGemFireHttpSession(maxInactiveIntervalInSeconds = 10) // <3>
|
||||
@EnableManager(start = true) // <4>
|
||||
public class GemFireServer {
|
||||
|
||||
public static void main(String[] args) {
|
||||
@@ -61,7 +61,7 @@ public class GemFireServer {
|
||||
|
||||
@Bean
|
||||
CacheServerConfigurer cacheServerPortConfigurer(
|
||||
@Value("${spring.session.data.geode.cache.server.port:40404}") int port) {
|
||||
@Value("${spring.session.data.geode.cache.server.port:40404}") int port) { // <5>
|
||||
|
||||
return (beanName, cacheServerFactoryBean) ->
|
||||
cacheServerFactoryBean.setPort(port);
|
||||
|
||||
Reference in New Issue
Block a user