@Bean public KeyGenerator customKeyGenerator() { return new SomeCustomKeyGenerator(); } }
@Override public Object generate(Object target, Method method, Object... params) { return generateKey(method.getName(), params); }
@Bean public KeyGenerator customKeyGenerator() { return new SomeCustomKeyGenerator(); }
@Override public Object generate(Object target, Method method, Object... params) { return generateKey(method.getName(), params); }
@Bean public KeyGenerator customKeyGenerator() { return new SomeCustomKeyGenerator(); }
@Test public void testCustomKeyGenerator() { Object param = new Object(); Object r1 = this.cs.customKeyGenerator(param); assertSame(r1, this.cs.customKeyGenerator(param)); Cache cache = this.cm.getCache("testCache"); // Checks that the custom keyGenerator was used Object expectedKey = SomeCustomKeyGenerator.generateKey("customKeyGenerator", param); assertNotNull(cache.get(expectedKey)); }
@Bean public KeyGenerator customKeyGenerator() { return new SomeCustomKeyGenerator(); }