Polishing (typo fixes etc, aligned with 5.0.x)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,39 +23,38 @@ import org.springframework.cache.interceptor.CacheOperation;
|
||||
|
||||
/**
|
||||
* Strategy interface for parsing known caching annotation types.
|
||||
* {@link AnnotationCacheOperationSource} delegates to such
|
||||
* parsers for supporting specific annotation types such as Spring's own
|
||||
* {@link Cacheable}, {@link CachePut} or {@link CacheEvict}.
|
||||
* {@link AnnotationCacheOperationSource} delegates to such parsers
|
||||
* for supporting specific annotation types such as Spring's own
|
||||
* {@link Cacheable}, {@link CachePut} and{@link CacheEvict}.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Stephane Nicoll
|
||||
* @since 3.1
|
||||
* @see AnnotationCacheOperationSource
|
||||
* @see SpringCacheAnnotationParser
|
||||
*/
|
||||
public interface CacheAnnotationParser {
|
||||
|
||||
/**
|
||||
* Parses the cache definition for the given class,
|
||||
* based on a known annotation type.
|
||||
* <p>This essentially parses a known cache annotation into Spring's
|
||||
* metadata attribute class. Returns {@code null} if the class
|
||||
* is not cacheable.
|
||||
* Parse the cache definition for the given class,
|
||||
* based on an annotation type understood by this parser.
|
||||
* <p>This essentially parses a known cache annotation into Spring's metadata
|
||||
* attribute class. Returns {@code null} if the class is not cacheable.
|
||||
* @param type the annotated class
|
||||
* @return CacheOperation the configured caching operation,
|
||||
* or {@code null} if none was found
|
||||
* @return the configured caching operation, or {@code null} if none found
|
||||
* @see AnnotationCacheOperationSource#findCacheOperations(Class)
|
||||
*/
|
||||
Collection<CacheOperation> parseCacheAnnotations(Class<?> type);
|
||||
|
||||
/**
|
||||
* Parses the cache definition for the given method,
|
||||
* based on a known annotation type.
|
||||
* <p>This essentially parses a known cache annotation into Spring's
|
||||
* metadata attribute class. Returns {@code null} if the method
|
||||
* is not cacheable.
|
||||
* Parse the cache definition for the given method,
|
||||
* based on an annotation type understood by this parser.
|
||||
* <p>This essentially parses a known cache annotation into Spring's metadata
|
||||
* attribute class. Returns {@code null} if the method is not cacheable.
|
||||
* @param method the annotated method
|
||||
* @return CacheOperation the configured caching operation,
|
||||
* or {@code null} if none was found
|
||||
* @return the configured caching operation, or {@code null} if none found
|
||||
* @see AnnotationCacheOperationSource#findCacheOperations(Method)
|
||||
*/
|
||||
Collection<CacheOperation> parseCacheAnnotations(Method method);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -55,7 +55,7 @@ public abstract class AbstractFallbackCacheOperationSource implements CacheOpera
|
||||
* Canonical value held in cache to indicate no caching attribute was
|
||||
* found for this method and we don't need to look again.
|
||||
*/
|
||||
private final static Collection<CacheOperation> NULL_CACHING_ATTRIBUTE = Collections.emptyList();
|
||||
private static final Collection<CacheOperation> NULL_CACHING_ATTRIBUTE = Collections.emptyList();
|
||||
|
||||
|
||||
/**
|
||||
@@ -163,23 +163,21 @@ public abstract class AbstractFallbackCacheOperationSource implements CacheOpera
|
||||
|
||||
|
||||
/**
|
||||
* Subclasses need to implement this to return the caching attribute
|
||||
* for the given method, if any.
|
||||
* @param method the method to retrieve the attribute for
|
||||
* @return all caching attribute associated with this method
|
||||
* (or {@code null} if none)
|
||||
*/
|
||||
protected abstract Collection<CacheOperation> findCacheOperations(Method method);
|
||||
|
||||
/**
|
||||
* Subclasses need to implement this to return the caching attribute
|
||||
* for the given class, if any.
|
||||
* Subclasses need to implement this to return the caching attribute for the
|
||||
* given class, if any.
|
||||
* @param clazz the class to retrieve the attribute for
|
||||
* @return all caching attribute associated with this class
|
||||
* (or {@code null} if none)
|
||||
* @return all caching attribute associated with this class, or {@code null} if none
|
||||
*/
|
||||
protected abstract Collection<CacheOperation> findCacheOperations(Class<?> clazz);
|
||||
|
||||
/**
|
||||
* Subclasses need to implement this to return the caching attribute for the
|
||||
* given method, if any.
|
||||
* @param method the method to retrieve the attribute for
|
||||
* @return all caching attribute associated with this method, or {@code null} if none
|
||||
*/
|
||||
protected abstract Collection<CacheOperation> findCacheOperations(Method method);
|
||||
|
||||
/**
|
||||
* Should only public methods be allowed to have caching semantics?
|
||||
* <p>The default implementation returns {@code false}.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -53,8 +53,8 @@ public interface ConfigurableApplicationContext extends ApplicationContext, Life
|
||||
/**
|
||||
* Name of the ConversionService bean in the factory.
|
||||
* If none is supplied, default conversion rules apply.
|
||||
* @see org.springframework.core.convert.ConversionService
|
||||
* @since 3.0
|
||||
* @see org.springframework.core.convert.ConversionService
|
||||
*/
|
||||
String CONVERSION_SERVICE_BEAN_NAME = "conversionService";
|
||||
|
||||
@@ -196,7 +196,7 @@ public interface ConfigurableApplicationContext extends ApplicationContext, Life
|
||||
* will already have been instantiated before. Use a BeanFactoryPostProcessor
|
||||
* to intercept the BeanFactory setup process before beans get touched.
|
||||
* <p>Generally, this internal factory will only be accessible while the context
|
||||
* is active, that is, inbetween {@link #refresh()} and {@link #close()}.
|
||||
* is active, that is, in-between {@link #refresh()} and {@link #close()}.
|
||||
* The {@link #isActive()} flag can be used to check whether the context
|
||||
* is in an appropriate state.
|
||||
* @return the underlying bean factory
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -334,7 +334,7 @@ public abstract class AbstractReflectiveMBeanInfoAssembler extends AbstractMBean
|
||||
/**
|
||||
* Iterate through all methods on the MBean class and gives subclasses the chance
|
||||
* to vote on their inclusion. If a particular method corresponds to the accessor
|
||||
* or mutator of an attribute that is inclued in the managment interface, then
|
||||
* or mutator of an attribute that is included in the management interface, then
|
||||
* the corresponding operation is exposed with the "role" descriptor
|
||||
* field set to the appropriate value.
|
||||
* @param managedBean the bean instance (might be an AOP proxy)
|
||||
@@ -358,25 +358,23 @@ public abstract class AbstractReflectiveMBeanInfoAssembler extends AbstractMBean
|
||||
|
||||
ModelMBeanOperationInfo info = null;
|
||||
PropertyDescriptor pd = BeanUtils.findPropertyForMethod(method);
|
||||
if (pd != null) {
|
||||
if ((method.equals(pd.getReadMethod()) && includeReadAttribute(method, beanKey)) ||
|
||||
(method.equals(pd.getWriteMethod()) && includeWriteAttribute(method, beanKey))) {
|
||||
// Attributes need to have their methods exposed as
|
||||
// operations to the JMX server as well.
|
||||
info = createModelMBeanOperationInfo(method, pd.getName(), beanKey);
|
||||
Descriptor desc = info.getDescriptor();
|
||||
if (method.equals(pd.getReadMethod())) {
|
||||
desc.setField(FIELD_ROLE, ROLE_GETTER);
|
||||
}
|
||||
else {
|
||||
desc.setField(FIELD_ROLE, ROLE_SETTER);
|
||||
}
|
||||
desc.setField(FIELD_VISIBILITY, ATTRIBUTE_OPERATION_VISIBILITY);
|
||||
if (isExposeClassDescriptor()) {
|
||||
desc.setField(FIELD_CLASS, getClassForDescriptor(managedBean).getName());
|
||||
}
|
||||
info.setDescriptor(desc);
|
||||
if (pd != null && ((method.equals(pd.getReadMethod()) && includeReadAttribute(method, beanKey)) ||
|
||||
(method.equals(pd.getWriteMethod()) && includeWriteAttribute(method, beanKey)))) {
|
||||
// Attributes need to have their methods exposed as
|
||||
// operations to the JMX server as well.
|
||||
info = createModelMBeanOperationInfo(method, pd.getName(), beanKey);
|
||||
Descriptor desc = info.getDescriptor();
|
||||
if (method.equals(pd.getReadMethod())) {
|
||||
desc.setField(FIELD_ROLE, ROLE_GETTER);
|
||||
}
|
||||
else {
|
||||
desc.setField(FIELD_ROLE, ROLE_SETTER);
|
||||
}
|
||||
desc.setField(FIELD_VISIBILITY, ATTRIBUTE_OPERATION_VISIBILITY);
|
||||
if (isExposeClassDescriptor()) {
|
||||
desc.setField(FIELD_CLASS, getClassForDescriptor(managedBean).getName());
|
||||
}
|
||||
info.setDescriptor(desc);
|
||||
}
|
||||
|
||||
// allow getters and setters to be marked as operations directly
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -127,7 +127,7 @@ public class ScheduledExecutorTask {
|
||||
/**
|
||||
* Set the period between repeated task executions, in milliseconds.
|
||||
* <p>Default is -1, leading to one-time execution. In case of a positive value,
|
||||
* the task will be executed repeatedly, with the given interval inbetween executions.
|
||||
* the task will be executed repeatedly, with the given interval in-between executions.
|
||||
* <p>Note that the semantics of the period value vary between fixed-rate and
|
||||
* fixed-delay execution.
|
||||
* <p><b>Note:</b> A period of 0 (for example as fixed delay) is <i>not</i> supported,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -69,7 +69,7 @@ import static org.junit.Assert.*;
|
||||
* @author Juergen Hoeller
|
||||
* @author Chris Beams
|
||||
*/
|
||||
public final class ProxyFactoryBeanTests {
|
||||
public class ProxyFactoryBeanTests {
|
||||
|
||||
private static final Class<?> CLASS = ProxyFactoryBeanTests.class;
|
||||
private static final String CLASSNAME = CLASS.getSimpleName();
|
||||
@@ -259,22 +259,22 @@ public final class ProxyFactoryBeanTests {
|
||||
|
||||
// Check it works without AOP
|
||||
SideEffectBean raw = (SideEffectBean) bf.getBean("prototypeTarget");
|
||||
assertEquals(INITIAL_COUNT, raw.getCount() );
|
||||
assertEquals(INITIAL_COUNT, raw.getCount());
|
||||
raw.doWork();
|
||||
assertEquals(INITIAL_COUNT+1, raw.getCount() );
|
||||
assertEquals(INITIAL_COUNT+1, raw.getCount());
|
||||
raw = (SideEffectBean) bf.getBean("prototypeTarget");
|
||||
assertEquals(INITIAL_COUNT, raw.getCount() );
|
||||
assertEquals(INITIAL_COUNT, raw.getCount());
|
||||
|
||||
// Now try with advised instances
|
||||
SideEffectBean prototype2FirstInstance = (SideEffectBean) bf.getBean(beanName);
|
||||
assertEquals(INITIAL_COUNT, prototype2FirstInstance.getCount() );
|
||||
assertEquals(INITIAL_COUNT, prototype2FirstInstance.getCount());
|
||||
prototype2FirstInstance.doWork();
|
||||
assertEquals(INITIAL_COUNT + 1, prototype2FirstInstance.getCount() );
|
||||
assertEquals(INITIAL_COUNT + 1, prototype2FirstInstance.getCount());
|
||||
|
||||
SideEffectBean prototype2SecondInstance = (SideEffectBean) bf.getBean(beanName);
|
||||
assertFalse("Prototypes are not ==", prototype2FirstInstance == prototype2SecondInstance);
|
||||
assertEquals(INITIAL_COUNT, prototype2SecondInstance.getCount() );
|
||||
assertEquals(INITIAL_COUNT + 1, prototype2FirstInstance.getCount() );
|
||||
assertEquals(INITIAL_COUNT, prototype2SecondInstance.getCount());
|
||||
assertEquals(INITIAL_COUNT + 1, prototype2FirstInstance.getCount());
|
||||
|
||||
return prototype2FirstInstance;
|
||||
}
|
||||
@@ -397,7 +397,7 @@ public final class ProxyFactoryBeanTests {
|
||||
config.removeAdvice(debugInterceptor);
|
||||
it.getSpouse();
|
||||
|
||||
// Still invoked wiht old reference
|
||||
// Still invoked with old reference
|
||||
assertEquals(2, debugInterceptor.getCount());
|
||||
|
||||
// not invoked with new object
|
||||
@@ -714,7 +714,7 @@ public final class ProxyFactoryBeanTests {
|
||||
@SuppressWarnings("serial")
|
||||
public static class PointcutForVoid extends DefaultPointcutAdvisor {
|
||||
|
||||
public static List<String> methodNames = new LinkedList<String>();
|
||||
public static List<String> methodNames = new LinkedList<>();
|
||||
|
||||
public static void reset() {
|
||||
methodNames.clear();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -97,7 +97,6 @@ public class EnableAsyncTests {
|
||||
fail("Should have thrown UnsatisfiedDependencyException");
|
||||
}
|
||||
catch (UnsatisfiedDependencyException ex) {
|
||||
ex.printStackTrace();
|
||||
assertTrue(ex.getCause() instanceof BeanNotOfRequiredTypeException);
|
||||
}
|
||||
}
|
||||
@@ -112,7 +111,6 @@ public class EnableAsyncTests {
|
||||
fail("Should have thrown UnsatisfiedDependencyException");
|
||||
}
|
||||
catch (UnsatisfiedDependencyException ex) {
|
||||
ex.printStackTrace();
|
||||
assertTrue(ex.getCause() instanceof BeanNotOfRequiredTypeException);
|
||||
}
|
||||
}
|
||||
@@ -219,8 +217,8 @@ public class EnableAsyncTests {
|
||||
ctx.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void spr14949FindsOnInterfaceWithInterfaceProxy() throws InterruptedException {
|
||||
@Test // SPR-14949
|
||||
public void findOnInterfaceWithInterfaceProxy() throws InterruptedException {
|
||||
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(Spr14949ConfigA.class);
|
||||
|
||||
AsyncInterface asyncBean = ctx.getBean(AsyncInterface.class);
|
||||
@@ -231,8 +229,8 @@ public class EnableAsyncTests {
|
||||
ctx.close();
|
||||
}
|
||||
|
||||
@Test @Ignore // TODO
|
||||
public void spr14949FindsOnInterfaceWithCglibProxy() throws InterruptedException {
|
||||
@Test @Ignore // SPR-14949
|
||||
public void findOnInterfaceWithCglibProxy() throws InterruptedException {
|
||||
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(Spr14949ConfigB.class);
|
||||
|
||||
AsyncInterface asyncBean = ctx.getBean(AsyncInterface.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -57,7 +57,6 @@ import static org.junit.Assert.*;
|
||||
/**
|
||||
* @author Kazuki Shimizu
|
||||
* @author Juergen Hoeller
|
||||
* @since 4.3
|
||||
*/
|
||||
public class SpringValidatorAdapterTests {
|
||||
|
||||
@@ -162,7 +161,7 @@ public class SpringValidatorAdapterTests {
|
||||
@Test // SPR-16177
|
||||
public void testWithSet() {
|
||||
Parent parent = new Parent();
|
||||
parent.setName("Parent whith set");
|
||||
parent.setName("Parent with set");
|
||||
parent.getChildSet().addAll(createChildren(parent));
|
||||
|
||||
BeanPropertyBindingResult errors = new BeanPropertyBindingResult(parent, "parent");
|
||||
@@ -185,6 +184,7 @@ public class SpringValidatorAdapterTests {
|
||||
return Arrays.asList(child1, child2);
|
||||
}
|
||||
|
||||
|
||||
@Same(field = "password", comparingField = "confirmPassword")
|
||||
@Same(field = "email", comparingField = "confirmEmail")
|
||||
static class TestBean {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<!-- We are only using one definition file for the purposes of this test, since we do not have multiple
|
||||
classloaders available in the environment to allow combining multiple files of the same name, but
|
||||
of course the contents within could be spread out across multiple files of the same name withing
|
||||
of course the contents within could be spread out across multiple files of the same name within
|
||||
different jars -->
|
||||
|
||||
<beans>
|
||||
|
||||
Reference in New Issue
Block a user