From 2243cb78fe142cfe8f55d0f6a76c3cfdb1cd2835 Mon Sep 17 00:00:00 2001 From: Alexander Alexeev Date: Sun, 11 Dec 2016 04:41:47 +0700 Subject: caching help --- .../www/configuration/WwwHelpConfiguration.java | 25 ++++++++++++++++++++++ .../juick/www/configuration/WwwInitializer.java | 6 +++++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 juick-spring-www/src/main/java/com/juick/www/configuration/WwwHelpConfiguration.java (limited to 'juick-spring-www/src/main/java/com/juick/www/configuration') diff --git a/juick-spring-www/src/main/java/com/juick/www/configuration/WwwHelpConfiguration.java b/juick-spring-www/src/main/java/com/juick/www/configuration/WwwHelpConfiguration.java new file mode 100644 index 00000000..d3b1aa9b --- /dev/null +++ b/juick-spring-www/src/main/java/com/juick/www/configuration/WwwHelpConfiguration.java @@ -0,0 +1,25 @@ +package com.juick.www.configuration; + +import com.juick.www.HelpService; +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.cache.guava.GuavaCacheManager; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Created by aalexeev on 12/11/16. + */ +@Configuration +@EnableCaching +public class WwwHelpConfiguration { + + @Bean + public GuavaCacheManager cacheManager() { + return new GuavaCacheManager("help"); + } + + @Bean + public HelpService helpService() { + return new HelpService("help"); + } +} diff --git a/juick-spring-www/src/main/java/com/juick/www/configuration/WwwInitializer.java b/juick-spring-www/src/main/java/com/juick/www/configuration/WwwInitializer.java index e62b1042..c8c162bd 100644 --- a/juick-spring-www/src/main/java/com/juick/www/configuration/WwwInitializer.java +++ b/juick-spring-www/src/main/java/com/juick/www/configuration/WwwInitializer.java @@ -17,7 +17,11 @@ public class WwwInitializer extends AbstractAnnotationConfigDispatcherServletIni @Override protected Class[] getRootConfigClasses() { return new Class[]{ - WebAppConfiguration.class, DataConfiguration.class, SearchConfiguration.class, WebSecurityConfig.class}; + WebAppConfiguration.class, + DataConfiguration.class, + SearchConfiguration.class, + WebSecurityConfig.class, + WwwHelpConfiguration.class}; } @Override -- cgit v1.2.3