Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories

Spring Cache not working in doFilter

How about extending org.springframework.web.filter.GenericFilterBean, and moving the caching details into a separate service class


import java.util.Arrays;

import org.springframework.cache.CacheManager;
import org.springframework.stereotype.Component;

    public class CacheService{

        public CacheManager cacheManager() {
            SimpleCacheManager cacheManager = new
            return cacheManager;

        public void display(int number) {
            // if cache working properly, code
below will not execute after the first calling
            for(int i=0; i<50; i++) {   
called" +number);



import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;


public class CredentialsInjectionFilter extends
GenericFilterBean {

    private CacheService cacheService;

    public void doFilter(ServletRequest
servletRequest, ServletResponse servletResponse,
FilterChain filterChain)
    throws IOException, ServletException {

Categories : Java

Related to : Spring Cache not working in doFilter
Spring Security UserDetails cache
EhCacheBasedUserCache uses, as the name implies, the widely used Ehcache library for actual caching. SpringCacheBasedUserCache uses Spring's own caching abstraction. With this you can for example plugin JCache, a.k.a. JSR-107. The reason you find fewer examples of this is that it is newer, the JSR-107 did not reach a Final Release until 18 Mar, 2014. Note that JSR-107 is an API, not an actual imp

Categories : Java
MongoDB Spring Data Repository - Cache methods
From the Spring documentation on caches: Spring recommends that you only annotate concrete classes (and methods of concrete classes) with the @Cache* annotation, as opposed to annotating interfaces. You certainly can place the @Cache* annotation on an interface (or an interface method), but this works only as you would expect it to if you are using interface-based proxies. The fact t

Categories : Java
Memory cache is not working properly
Let me answer it myself... Code in Uboot is a little misleading... it run set_section_dcache(i, DCACHE_WRITEBACK_WRITETHROUGH) but after checking the MMU, it turns out that the memory type is set to be device.

Categories : Caching
Want a cache filter attribute that keep data in cache till user logged in
HttpResponse.RemoveOutputCacheItem should work unless you are using querystring or additional route parameters. You can always use VaryByCustomto make sure cache holds only for a duration of a session but you have to make sure you clear the session once user is logged out. Global.asax.cs: public class MvcApplication : HttpApplication { ... public override string GetVaryByCustomString(HttpC

Categories : C#
Chrome clear cache extension - when run cache is not cleared immediately
The chrome.browsingData.removeCache method is asynchronous (i.e. non-blocking). This means that if you immediately reload the tab after calling removeCache, the removeCache call is still being processed and the cache may not be empty yet. To get the desired behavior, wait until the cache is cleared, by putting the reload call in the callback to removeCache. And by the way, you don't need to call

Categories : Javascript
Recently Add
Redirecting the output directory of 'mvn package' or 'mvn compile' command
No suitable constructor found for ProductoExtranjero
java Composite design pattern(Directory &File)
Java JTree's ui refresh after removing node from parent
First REST Spring application
How to cancel Indexing of a Solr document using Update Request Processor
PowerMock - Mock a Singleton with a Private Constructor
Calling a Postgres stored function SQL error
Where to store Morphlines Java custom command class?
Generic repository using map
How can I scroll a ScrolledComposited in Eclipse SWT Design view?
2 Frames/layout in 1 Activity
Writing a switch differently
Next button opens another activity when its reaches the array limit
Is EclipseLink MOXy capable of applying JSR-303 Bean Validation when unmarshalling XML to object?
Why my jdk can't work,and before the java_home, there is a space that is not from me
How to add List of objects in a Map
How to make notepad++ function like regular notepad in cmd?
Cell renderer and the lost focus
how can I implement iterable for LinkedList>
Disable Androids image-crunch in eclipse (run as) builds
java 8 lambda != myMap.size() after merging myMap
Issue with Calendar calculation that spans 2 calendar years
JSF 2.0 Spring bean injection
Java Regex ReplaceAll with grouping
Getting any word and last word using sed
Clicking on link on JEditorPane throws IOException
printing out difference of two arrays
Spring Bean Alias in JavaConfig
Using Factory Method to Create Generics
© Copyright 2017 Publishing Limited. All rights reserved.