mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-18 00:49:02 +00:00
Compare commits
91
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7a847efa8c | ||
|
|
e731a0a164 | ||
|
|
0f2efdbe97 | ||
|
|
feeeab1761 | ||
|
|
b4cf471021 | ||
|
|
82751141ac | ||
|
|
9f43ee3304 | ||
|
|
614c7b0f8e | ||
|
|
cc84533d85 | ||
|
|
6faf61ba40 | ||
|
|
80a5019534 | ||
|
|
03bd02a627 | ||
|
|
f16aa4a9b5 | ||
|
|
a3c9e8d4fc | ||
|
|
3814f12b67 | ||
|
|
ceb881ab05 | ||
|
|
871464811c | ||
|
|
cf1b7620c7 | ||
|
|
7ca96c02bd | ||
|
|
3a377f86b2 | ||
|
|
7854f49643 | ||
|
|
53dcb00074 | ||
|
|
562c0871e9 | ||
|
|
7f8966774e | ||
|
|
9689a59ab1 | ||
|
|
7d126d3288 | ||
|
|
e9dc5160b9 | ||
|
|
3616e96792 | ||
|
|
357beb24bc | ||
|
|
17c423f5af | ||
|
|
b1ed0511f7 | ||
|
|
bb6f9bb6d4 | ||
|
|
0519a2ff3c | ||
|
|
6a08bfdff7 | ||
|
|
da44a247cb | ||
|
|
20fc7e178a | ||
|
|
31c881468c | ||
|
|
955000699a | ||
|
|
99d9dacc4f | ||
|
|
2794264480 | ||
|
|
4edc7196fb | ||
|
|
8f6846827d | ||
|
|
b2aad1c3b1 | ||
|
|
ca2b2f5533 | ||
|
|
b65984a078 | ||
|
|
b1b25fab00 | ||
|
|
e9454b8b11 | ||
|
|
d945ae9191 | ||
|
|
d09f537699 | ||
|
|
c8f20815ef | ||
|
|
60976e4116 | ||
|
|
bd28bb1f56 | ||
|
|
aa69703f3b | ||
|
|
a871f609ea | ||
|
|
f259fda8eb | ||
|
|
23be5dfb0e | ||
|
|
b7eaab4c5d | ||
|
|
07b0fa132e | ||
|
|
6eb0e9e44b | ||
|
|
9db4118180 | ||
|
|
b159ef6019 | ||
|
|
961010055e | ||
|
|
a7aecbb4dc | ||
|
|
d036b5a283 | ||
|
|
3a132f8c3c | ||
|
|
1187fea65c | ||
|
|
e26cdfe21e | ||
|
|
f37ec90f2f | ||
|
|
f748b1e68d | ||
|
|
9729b460f1 | ||
|
|
a496353770 | ||
|
|
d709a69ff1 | ||
|
|
2c5958e191 | ||
|
|
4f4b9f6b1b | ||
|
|
4e4ec266b2 | ||
|
|
bd8f94ad7b | ||
|
|
c2d71922d7 | ||
|
|
88e9dcef0c | ||
|
|
4a4edeb97f | ||
|
|
dd22b8fd39 | ||
|
|
8189c90741 | ||
|
|
9d2a874e3f | ||
|
|
a7bb5ca473 | ||
|
|
6d8bf3466c | ||
|
|
b86c11cc9b | ||
|
|
122e2ca2ac | ||
|
|
806fcb3839 | ||
|
|
30ebc3b8e2 | ||
|
|
a092dc055e | ||
|
|
70be7117f3 | ||
|
|
f13a6d4f32 |
@@ -24,6 +24,10 @@ buildSrc/build
|
||||
/src/asciidoc/build
|
||||
target/
|
||||
|
||||
# Projects not in this branch
|
||||
integration-tests/
|
||||
spring-core/kotlin-coroutines/
|
||||
|
||||
# Eclipse artifacts, including WTP generated manifests
|
||||
.classpath
|
||||
.project
|
||||
|
||||
+9
-10
@@ -30,22 +30,22 @@ ext {
|
||||
|
||||
aspectjVersion = "1.9.4"
|
||||
freemarkerVersion = "2.3.28"
|
||||
groovyVersion = "2.5.7"
|
||||
groovyVersion = "2.5.8"
|
||||
hsqldbVersion = "2.4.1"
|
||||
jackson2Version = "2.9.9"
|
||||
jettyVersion = "9.4.19.v20190610"
|
||||
jettyVersion = "9.4.21.v20190926"
|
||||
junit5Version = "5.3.2"
|
||||
kotlinVersion = "1.2.71"
|
||||
log4jVersion = "2.11.2"
|
||||
nettyVersion = "4.1.38.Final"
|
||||
reactorVersion = "Californium-SR10"
|
||||
nettyVersion = "4.1.43.Final"
|
||||
reactorVersion = "Californium-SR13"
|
||||
rxjavaVersion = "1.3.8"
|
||||
rxjavaAdapterVersion = "1.2.1"
|
||||
rxjava2Version = "2.2.10"
|
||||
slf4jVersion = "1.7.26" // spring-jcl + consistent 3rd party deps
|
||||
rxjava2Version = "2.2.13"
|
||||
slf4jVersion = "1.7.28" // spring-jcl + consistent 3rd party deps
|
||||
tiles3Version = "3.0.8"
|
||||
tomcatVersion = "9.0.22"
|
||||
undertowVersion = "2.0.23.Final"
|
||||
tomcatVersion = "9.0.27"
|
||||
undertowVersion = "2.0.27.Final"
|
||||
|
||||
gradleScriptDir = "${rootProject.projectDir}/gradle"
|
||||
withoutJclOverSlf4j = {
|
||||
@@ -139,11 +139,10 @@ configure(allprojects) { project ->
|
||||
// classes with the "$" pattern; otherwise, using -Dtest.single=MyTests to
|
||||
// run MyTests by itself will fail if MyTests contains any inner classes.
|
||||
exclude(["**/Abstract*.class", '**/*$*'])
|
||||
reports.junitXml.setDestination(file("$buildDir/test-results"))
|
||||
}
|
||||
|
||||
checkstyle {
|
||||
toolVersion = "8.23"
|
||||
toolVersion = "8.26"
|
||||
configDir = rootProject.file("src/checkstyle")
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
version=5.1.9.BUILD-SNAPSHOT
|
||||
version=5.1.11.RELEASE
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2019 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,6 +23,11 @@ package org.springframework.aop;
|
||||
* <p>Can be used as part of a {@link Pointcut} or for the entire
|
||||
* targeting of an {@link IntroductionAdvisor}.
|
||||
*
|
||||
* <p>Concrete implementations of this interface typically should provide proper
|
||||
* implementations of {@link Object#equals(Object)} and {@link Object#hashCode()}
|
||||
* in order to allow the filter to be used in caching scenarios — for
|
||||
* example, in proxies generated by CGLIB.
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @see Pointcut
|
||||
* @see MethodMatcher
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -40,6 +40,11 @@ import java.lang.reflect.Method;
|
||||
* in an interceptor chain, will have run, so any state changes they have produced in
|
||||
* parameters or ThreadLocal state will be available at the time of evaluation.
|
||||
*
|
||||
* <p>Concrete implementations of this interface typically should provide proper
|
||||
* implementations of {@link Object#equals(Object)} and {@link Object#hashCode()}
|
||||
* in order to allow the matcher to be used in caching scenarios — for
|
||||
* example, in proxies generated by CGLIB.
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @since 11.11.2003
|
||||
* @see Pointcut
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -735,6 +735,11 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
||||
public int hashCode() {
|
||||
return this.adviceMethod.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getName() + ": " + this.adviceMethod;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+20
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -22,6 +22,7 @@ import org.aspectj.weaver.tools.TypePatternMatcher;
|
||||
import org.springframework.aop.ClassFilter;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -29,6 +30,7 @@ import org.springframework.util.StringUtils;
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
* @author Sam Brannen
|
||||
* @since 2.0
|
||||
*/
|
||||
public class TypePatternClassFilter implements ClassFilter {
|
||||
@@ -113,4 +115,21 @@ public class TypePatternClassFilter implements ClassFilter {
|
||||
result = StringUtils.replace(result, " or ", " || ");
|
||||
return StringUtils.replace(result, " not ", " ! ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
return (this == other || (other instanceof TypePatternClassFilter &&
|
||||
ObjectUtils.nullSafeEquals(this.typePattern, ((TypePatternClassFilter) other).typePattern)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return ObjectUtils.nullSafeHashCode(this.typePattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getName() + ": " + this.typePattern;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -327,10 +327,11 @@ class CglibAopProxy implements AopProxy, Serializable {
|
||||
|
||||
// TODO: small memory optimization here (can skip creation for methods with no advice)
|
||||
for (int x = 0; x < methods.length; x++) {
|
||||
List<Object> chain = this.advised.getInterceptorsAndDynamicInterceptionAdvice(methods[x], rootClass);
|
||||
Method method = methods[x];
|
||||
List<Object> chain = this.advised.getInterceptorsAndDynamicInterceptionAdvice(method, rootClass);
|
||||
fixedCallbacks[x] = new FixedChainStaticTargetInterceptor(
|
||||
chain, this.advised.getTargetSource().getTarget(), this.advised.getTargetClass());
|
||||
this.fixedInterceptorMap.put(methods[x].toString(), x);
|
||||
this.fixedInterceptorMap.put(methods.toString(), x);
|
||||
}
|
||||
|
||||
// Now copy both the callbacks from mainCallbacks
|
||||
@@ -633,8 +634,8 @@ class CglibAopProxy implements AopProxy, Serializable {
|
||||
@Override
|
||||
@Nullable
|
||||
public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
|
||||
MethodInvocation invocation = new CglibMethodInvocation(proxy, this.target, method, args,
|
||||
this.targetClass, this.adviceChain, methodProxy);
|
||||
MethodInvocation invocation = new CglibMethodInvocation(
|
||||
proxy, this.target, method, args, this.targetClass, this.adviceChain, methodProxy);
|
||||
// If we get here, we need to create a MethodInvocation.
|
||||
Object retVal = invocation.proceed();
|
||||
retVal = processReturnType(proxy, this.target, method, retVal);
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -68,7 +68,7 @@ public class ReflectiveMethodInvocation implements ProxyMethodInvocation, Clonea
|
||||
|
||||
protected final Method method;
|
||||
|
||||
protected Object[] arguments = new Object[0];
|
||||
protected Object[] arguments;
|
||||
|
||||
@Nullable
|
||||
private final Class<?> targetClass;
|
||||
@@ -158,7 +158,7 @@ public class ReflectiveMethodInvocation implements ProxyMethodInvocation, Clonea
|
||||
@Override
|
||||
@Nullable
|
||||
public Object proceed() throws Throwable {
|
||||
// We start with an index of -1 and increment early.
|
||||
// We start with an index of -1 and increment early.
|
||||
if (this.currentInterceptorIndex == this.interceptorsAndDynamicMethodMatchers.size() - 1) {
|
||||
return invokeJoinpoint();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2019 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,20 +23,25 @@ import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Utility class for creating a scoped proxy.
|
||||
* Used by ScopedProxyBeanDefinitionDecorator and ClassPathBeanDefinitionScanner.
|
||||
*
|
||||
* <p>Used by ScopedProxyBeanDefinitionDecorator and ClassPathBeanDefinitionScanner.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @author Juergen Hoeller
|
||||
* @author Rob Harrop
|
||||
* @author Sam Brannen
|
||||
* @since 2.5
|
||||
*/
|
||||
public abstract class ScopedProxyUtils {
|
||||
|
||||
private static final String TARGET_NAME_PREFIX = "scopedTarget.";
|
||||
|
||||
private static final int TARGET_NAME_PREFIX_LENGTH = TARGET_NAME_PREFIX.length();
|
||||
|
||||
|
||||
/**
|
||||
* Generate a scoped proxy for the supplied target bean, registering the target
|
||||
@@ -45,6 +50,8 @@ public abstract class ScopedProxyUtils {
|
||||
* @param registry the bean definition registry
|
||||
* @param proxyTargetClass whether to create a target class proxy
|
||||
* @return the scoped proxy definition
|
||||
* @see #getTargetBeanName(String)
|
||||
* @see #getOriginalBeanName(String)
|
||||
*/
|
||||
public static BeanDefinitionHolder createScopedProxy(BeanDefinitionHolder definition,
|
||||
BeanDefinitionRegistry registry, boolean proxyTargetClass) {
|
||||
@@ -93,11 +100,29 @@ public abstract class ScopedProxyUtils {
|
||||
* Generate the bean name that is used within the scoped proxy to reference the target bean.
|
||||
* @param originalBeanName the original name of bean
|
||||
* @return the generated bean to be used to reference the target bean
|
||||
* @see #getOriginalBeanName(String)
|
||||
*/
|
||||
public static String getTargetBeanName(String originalBeanName) {
|
||||
return TARGET_NAME_PREFIX + originalBeanName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the original bean name for the provided {@linkplain #getTargetBeanName
|
||||
* target bean name}.
|
||||
* @param targetBeanName the target bean name for the scoped proxy
|
||||
* @return the original bean name
|
||||
* @throws IllegalArgumentException if the supplied bean name does not refer
|
||||
* to the target of a scoped proxy
|
||||
* @since 5.1.10
|
||||
* @see #getTargetBeanName(String)
|
||||
* @see #isScopedTarget(String)
|
||||
*/
|
||||
public static String getOriginalBeanName(String targetBeanName) {
|
||||
Assert.isTrue(isScopedTarget(targetBeanName), () -> "bean name '" +
|
||||
targetBeanName + "' does not refer to the target of a scoped proxy");
|
||||
return targetBeanName.substring(TARGET_NAME_PREFIX_LENGTH);
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify if the {@code beanName} is the name of a bean that references the target
|
||||
* bean within a scoped proxy.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.aop.support;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.springframework.aop.ClassFilter;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -28,6 +29,7 @@ import org.springframework.util.ObjectUtils;
|
||||
* @author Rod Johnson
|
||||
* @author Rob Harrop
|
||||
* @author Juergen Hoeller
|
||||
* @author Sam Brannen
|
||||
* @since 11.11.2003
|
||||
* @see MethodMatchers
|
||||
* @see Pointcuts
|
||||
@@ -89,9 +91,9 @@ public abstract class ClassFilters {
|
||||
@SuppressWarnings("serial")
|
||||
private static class UnionClassFilter implements ClassFilter, Serializable {
|
||||
|
||||
private ClassFilter[] filters;
|
||||
private final ClassFilter[] filters;
|
||||
|
||||
public UnionClassFilter(ClassFilter[] filters) {
|
||||
UnionClassFilter(ClassFilter[] filters) {
|
||||
this.filters = filters;
|
||||
}
|
||||
|
||||
@@ -115,6 +117,12 @@ public abstract class ClassFilters {
|
||||
public int hashCode() {
|
||||
return ObjectUtils.nullSafeHashCode(this.filters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getName() + ": " + Arrays.toString(this.filters);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -124,9 +132,9 @@ public abstract class ClassFilters {
|
||||
@SuppressWarnings("serial")
|
||||
private static class IntersectionClassFilter implements ClassFilter, Serializable {
|
||||
|
||||
private ClassFilter[] filters;
|
||||
private final ClassFilter[] filters;
|
||||
|
||||
public IntersectionClassFilter(ClassFilter[] filters) {
|
||||
IntersectionClassFilter(ClassFilter[] filters) {
|
||||
this.filters = filters;
|
||||
}
|
||||
|
||||
@@ -150,6 +158,12 @@ public abstract class ClassFilters {
|
||||
public int hashCode() {
|
||||
return ObjectUtils.nullSafeHashCode(this.filters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getName() + ": " + Arrays.toString(this.filters);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -24,12 +24,15 @@ import org.springframework.aop.Pointcut;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Convenient class for building up pointcuts. All methods return
|
||||
* ComposablePointcut, so we can use a concise idiom like:
|
||||
* Convenient class for building up pointcuts.
|
||||
*
|
||||
* {@code
|
||||
* Pointcut pc = new ComposablePointcut().union(classFilter).intersection(methodMatcher).intersection(pointcut);
|
||||
* }
|
||||
* <p>All methods return {@code ComposablePointcut}, so we can use concise idioms
|
||||
* like in the following example.
|
||||
*
|
||||
* <pre class="code">Pointcut pc = new ComposablePointcut()
|
||||
* .union(classFilter)
|
||||
* .intersection(methodMatcher)
|
||||
* .intersection(pointcut);</pre>
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
@@ -199,7 +202,7 @@ public class ComposablePointcut implements Pointcut, Serializable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ComposablePointcut: " + this.classFilter + ", " +this.methodMatcher;
|
||||
return getClass().getName() + ": " + this.classFilter + ", " + this.methodMatcher;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,14 +34,15 @@ import org.springframework.util.ObjectUtils;
|
||||
* @author Rod Johnson
|
||||
* @author Rob Harrop
|
||||
* @author Juergen Hoeller
|
||||
* @author Sam Brannen
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class ControlFlowPointcut implements Pointcut, ClassFilter, MethodMatcher, Serializable {
|
||||
|
||||
private Class<?> clazz;
|
||||
private final Class<?> clazz;
|
||||
|
||||
@Nullable
|
||||
private String methodName;
|
||||
private final String methodName;
|
||||
|
||||
private volatile int evaluations;
|
||||
|
||||
@@ -142,4 +143,9 @@ public class ControlFlowPointcut implements Pointcut, ClassFilter, MethodMatcher
|
||||
return code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getName() + ": class = " + this.clazz.getName() + "; methodName = " + methodName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+14
-14
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -39,7 +39,7 @@ import org.springframework.util.ClassUtils;
|
||||
* @author Juergen Hoeller
|
||||
* @since 11.11.2003
|
||||
*/
|
||||
@SuppressWarnings({"serial" })
|
||||
@SuppressWarnings("serial")
|
||||
public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFilter, Ordered, Serializable {
|
||||
|
||||
private final Advice advice;
|
||||
@@ -82,25 +82,25 @@ public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFil
|
||||
/**
|
||||
* Create a DefaultIntroductionAdvisor for the given advice.
|
||||
* @param advice the Advice to apply
|
||||
* @param intf the interface to introduce
|
||||
* @param ifc the interface to introduce
|
||||
*/
|
||||
public DefaultIntroductionAdvisor(DynamicIntroductionAdvice advice, Class<?> intf) {
|
||||
public DefaultIntroductionAdvisor(DynamicIntroductionAdvice advice, Class<?> ifc) {
|
||||
Assert.notNull(advice, "Advice must not be null");
|
||||
this.advice = advice;
|
||||
addInterface(intf);
|
||||
addInterface(ifc);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add the specified interface to the list of interfaces to introduce.
|
||||
* @param intf the interface to introduce
|
||||
* @param ifc the interface to introduce
|
||||
*/
|
||||
public void addInterface(Class<?> intf) {
|
||||
Assert.notNull(intf, "Interface must not be null");
|
||||
if (!intf.isInterface()) {
|
||||
throw new IllegalArgumentException("Specified class [" + intf.getName() + "] must be an interface");
|
||||
public void addInterface(Class<?> ifc) {
|
||||
Assert.notNull(ifc, "Interface must not be null");
|
||||
if (!ifc.isInterface()) {
|
||||
throw new IllegalArgumentException("Specified class [" + ifc.getName() + "] must be an interface");
|
||||
}
|
||||
this.interfaces.add(intf);
|
||||
this.interfaces.add(ifc);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -113,8 +113,8 @@ public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFil
|
||||
for (Class<?> ifc : this.interfaces) {
|
||||
if (this.advice instanceof DynamicIntroductionAdvice &&
|
||||
!((DynamicIntroductionAdvice) this.advice).implementsInterface(ifc)) {
|
||||
throw new IllegalArgumentException("DynamicIntroductionAdvice [" + this.advice + "] " +
|
||||
"does not implement interface [" + ifc.getName() + "] specified for introduction");
|
||||
throw new IllegalArgumentException("DynamicIntroductionAdvice [" + this.advice + "] " +
|
||||
"does not implement interface [" + ifc.getName() + "] specified for introduction");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -168,7 +168,7 @@ public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFil
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ClassUtils.getShortName(getClass()) + ": advice [" + this.advice + "]; interfaces " +
|
||||
return getClass().getName() + ": advice [" + this.advice + "]; interfaces " +
|
||||
ClassUtils.classNamesToString(this.interfaces);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -34,6 +34,7 @@ import org.springframework.util.Assert;
|
||||
* @author Rod Johnson
|
||||
* @author Rob Harrop
|
||||
* @author Juergen Hoeller
|
||||
* @author Sam Brannen
|
||||
* @since 11.11.2003
|
||||
* @see ClassFilters
|
||||
* @see Pointcuts
|
||||
@@ -155,6 +156,11 @@ public abstract class MethodMatchers {
|
||||
public int hashCode() {
|
||||
return 37 * this.mm1.hashCode() + this.mm2.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getName() + ": " + this.mm1 + ", " + this.mm2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -229,6 +235,11 @@ public abstract class MethodMatchers {
|
||||
// Allow for matching with regular UnionMethodMatcher by providing same hash...
|
||||
return super.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getName() + ": " + this.cf1 + ", " + this.mm1 + ", " + this.cf2 + ", " + this.mm2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -311,6 +322,11 @@ public abstract class MethodMatchers {
|
||||
public int hashCode() {
|
||||
return 37 * this.mm1.hashCode() + this.mm2.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getName() + ": " + this.mm1 + ", " + this.mm2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+9
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -25,8 +25,9 @@ import java.util.List;
|
||||
import org.springframework.util.PatternMatchUtils;
|
||||
|
||||
/**
|
||||
* Pointcut bean for simple method name matches, as alternative to regexp patterns.
|
||||
* Does not handle overloaded methods: all methods with a given name will be eligible.
|
||||
* Pointcut bean for simple method name matches, as an alternative to regexp patterns.
|
||||
*
|
||||
* <p>Does not handle overloaded methods: all methods with a given name will be eligible.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @author Rod Johnson
|
||||
@@ -108,4 +109,9 @@ public class NameMatchMethodPointcut extends StaticMethodMatcherPointcut impleme
|
||||
return this.mappedNames.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getName() + ": " + this.mappedNames;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -26,7 +26,8 @@ import org.springframework.util.Assert;
|
||||
/**
|
||||
* Pointcut constants for matching getters and setters,
|
||||
* and static methods useful for manipulating and evaluating pointcuts.
|
||||
* These methods are particularly useful for composing pointcuts
|
||||
*
|
||||
* <p>These methods are particularly useful for composing pointcuts
|
||||
* using the union and intersection methods.
|
||||
*
|
||||
* @author Rod Johnson
|
||||
@@ -106,6 +107,11 @@ public abstract class Pointcuts {
|
||||
private Object readResolve() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Pointcuts.SETTERS";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -126,6 +132,11 @@ public abstract class Pointcuts {
|
||||
private Object readResolve() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Pointcuts.GETTERS";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -19,19 +19,22 @@ package org.springframework.aop.support;
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.springframework.aop.ClassFilter;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Simple ClassFilter implementation that passes classes (and optionally subclasses).
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @author Sam Brannen
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class RootClassFilter implements ClassFilter, Serializable {
|
||||
|
||||
private Class<?> clazz;
|
||||
private final Class<?> clazz;
|
||||
|
||||
|
||||
public RootClassFilter(Class<?> clazz) {
|
||||
Assert.notNull(clazz, "Class must not be null");
|
||||
this.clazz = clazz;
|
||||
}
|
||||
|
||||
@@ -41,4 +44,20 @@ public class RootClassFilter implements ClassFilter, Serializable {
|
||||
return this.clazz.isAssignableFrom(candidate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
return (this == other || (other instanceof RootClassFilter &&
|
||||
this.clazz.equals(((RootClassFilter) other).clazz)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.clazz.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getName() + ": " + this.clazz.getName();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -62,7 +62,7 @@ public class AnnotationMatchingPointcut implements Pointcut {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new AnnotationMatchingPointcut for the given annotation type.
|
||||
* Create a new AnnotationMatchingPointcut for the given annotation types.
|
||||
* @param classAnnotationType the annotation type to look for at the class level
|
||||
* (can be {@code null})
|
||||
* @param methodAnnotationType the annotation type to look for at the method level
|
||||
@@ -75,7 +75,7 @@ public class AnnotationMatchingPointcut implements Pointcut {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new AnnotationMatchingPointcut for the given annotation type.
|
||||
* Create a new AnnotationMatchingPointcut for the given annotation types.
|
||||
* @param classAnnotationType the annotation type to look for at the class level
|
||||
* (can be {@code null})
|
||||
* @param methodAnnotationType the annotation type to look for at the method level
|
||||
@@ -138,7 +138,7 @@ public class AnnotationMatchingPointcut implements Pointcut {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AnnotationMatchingPointcut: " + this.classFilter + ", " +this.methodMatcher;
|
||||
return "AnnotationMatchingPointcut: " + this.classFilter + ", " + this.methodMatcher;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -31,6 +31,7 @@ import org.springframework.util.Assert;
|
||||
* interface, if any, and the corresponding method on the target class).
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @author Sam Brannen
|
||||
* @since 2.0
|
||||
* @see AnnotationMatchingPointcut
|
||||
*/
|
||||
@@ -94,7 +95,7 @@ public class AnnotationMethodMatcher extends StaticMethodMatcher {
|
||||
return false;
|
||||
}
|
||||
AnnotationMethodMatcher otherMm = (AnnotationMethodMatcher) other;
|
||||
return this.annotationType.equals(otherMm.annotationType);
|
||||
return (this.annotationType.equals(otherMm.annotationType) && this.checkInherited == otherMm.checkInherited);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+32
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -34,6 +34,7 @@ import static org.junit.Assert.*;
|
||||
* @author Rod Johnson
|
||||
* @author Rick Evans
|
||||
* @author Chris Beams
|
||||
* @author Sam Brannen
|
||||
*/
|
||||
public class TypePatternClassFilterTests {
|
||||
|
||||
@@ -88,4 +89,34 @@ public class TypePatternClassFilterTests {
|
||||
new TypePatternClassFilter().matches(String.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEquals() {
|
||||
TypePatternClassFilter filter1 = new TypePatternClassFilter("org.springframework.tests.sample.beans.*");
|
||||
TypePatternClassFilter filter2 = new TypePatternClassFilter("org.springframework.tests.sample.beans.*");
|
||||
TypePatternClassFilter filter3 = new TypePatternClassFilter("org.springframework.tests.*");
|
||||
|
||||
assertEquals(filter1, filter2);
|
||||
assertNotEquals(filter1, filter3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHashCode() {
|
||||
TypePatternClassFilter filter1 = new TypePatternClassFilter("org.springframework.tests.sample.beans.*");
|
||||
TypePatternClassFilter filter2 = new TypePatternClassFilter("org.springframework.tests.sample.beans.*");
|
||||
TypePatternClassFilter filter3 = new TypePatternClassFilter("org.springframework.tests.*");
|
||||
|
||||
assertEquals(filter1.hashCode(), filter2.hashCode());
|
||||
assertNotEquals(filter1.hashCode(), filter3.hashCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToString() {
|
||||
TypePatternClassFilter filter1 = new TypePatternClassFilter("org.springframework.tests.sample.beans.*");
|
||||
TypePatternClassFilter filter2 = new TypePatternClassFilter("org.springframework.tests.sample.beans.*");
|
||||
|
||||
assertEquals("org.springframework.aop.aspectj.TypePatternClassFilter: org.springframework.tests.sample.beans.*",
|
||||
filter1.toString());
|
||||
assertEquals(filter1.toString(), filter2.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.aop.framework;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.accessibility.Accessible;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.RootPaneContainer;
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright 2002-2019 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aop.scope;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link ScopedProxyUtils}.
|
||||
*
|
||||
* @author Sam Brannen
|
||||
* @since 5.1.10
|
||||
*/
|
||||
public class ScopedProxyUtilsTests {
|
||||
|
||||
@Rule
|
||||
public final ExpectedException exception = ExpectedException.none();
|
||||
|
||||
|
||||
@Test
|
||||
public void getTargetBeanNameAndIsScopedTarget() {
|
||||
String originalBeanName = "myBean";
|
||||
String targetBeanName = ScopedProxyUtils.getTargetBeanName(originalBeanName);
|
||||
|
||||
assertNotEquals(originalBeanName, targetBeanName);
|
||||
assertTrue(targetBeanName.endsWith(originalBeanName));
|
||||
assertTrue(ScopedProxyUtils.isScopedTarget(targetBeanName));
|
||||
assertFalse(ScopedProxyUtils.isScopedTarget(originalBeanName));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getOriginalBeanNameAndIsScopedTarget() {
|
||||
String originalBeanName = "myBean";
|
||||
String targetBeanName = ScopedProxyUtils.getTargetBeanName(originalBeanName);
|
||||
String parsedOriginalBeanName = ScopedProxyUtils.getOriginalBeanName(targetBeanName);
|
||||
|
||||
assertNotEquals(targetBeanName, parsedOriginalBeanName);
|
||||
assertEquals(originalBeanName, parsedOriginalBeanName);
|
||||
assertTrue(ScopedProxyUtils.isScopedTarget(targetBeanName));
|
||||
assertFalse(ScopedProxyUtils.isScopedTarget(parsedOriginalBeanName));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getOriginalBeanNameForNullTargetBean() {
|
||||
exception.expect(IllegalArgumentException.class);
|
||||
exception.expectMessage("bean name 'null' does not refer to the target of a scoped proxy");
|
||||
ScopedProxyUtils.getOriginalBeanName(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getOriginalBeanNameForNonScopedTarget() {
|
||||
exception.expect(IllegalArgumentException.class);
|
||||
exception.expectMessage("bean name 'myBean' does not refer to the target of a scoped proxy");
|
||||
ScopedProxyUtils.getOriginalBeanName("myBean");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2019 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,46 @@ import org.springframework.core.NestedRuntimeException;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link ClassFilters}.
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @author Chris Beams
|
||||
* @author Sam Brannen
|
||||
*/
|
||||
public class ClassFiltersTests {
|
||||
|
||||
private ClassFilter exceptionFilter = new RootClassFilter(Exception.class);
|
||||
private final ClassFilter exceptionFilter = new RootClassFilter(Exception.class);
|
||||
|
||||
private ClassFilter itbFilter = new RootClassFilter(ITestBean.class);
|
||||
private final ClassFilter interfaceFilter = new RootClassFilter(ITestBean.class);
|
||||
|
||||
private final ClassFilter hasRootCauseFilter = new RootClassFilter(NestedRuntimeException.class);
|
||||
|
||||
private ClassFilter hasRootCauseFilter = new RootClassFilter(NestedRuntimeException.class);
|
||||
|
||||
@Test
|
||||
public void testUnion() {
|
||||
public void union() {
|
||||
assertTrue(exceptionFilter.matches(RuntimeException.class));
|
||||
assertFalse(exceptionFilter.matches(TestBean.class));
|
||||
assertFalse(itbFilter.matches(Exception.class));
|
||||
assertTrue(itbFilter.matches(TestBean.class));
|
||||
ClassFilter union = ClassFilters.union(exceptionFilter, itbFilter);
|
||||
assertFalse(interfaceFilter.matches(Exception.class));
|
||||
assertTrue(interfaceFilter.matches(TestBean.class));
|
||||
ClassFilter union = ClassFilters.union(exceptionFilter, interfaceFilter);
|
||||
assertTrue(union.matches(RuntimeException.class));
|
||||
assertTrue(union.matches(TestBean.class));
|
||||
assertTrue(union.toString().matches("^.+UnionClassFilter: \\[.+RootClassFilter: .+Exception, .+RootClassFilter: .+TestBean\\]$"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIntersection() {
|
||||
public void intersection() {
|
||||
assertTrue(exceptionFilter.matches(RuntimeException.class));
|
||||
assertTrue(hasRootCauseFilter.matches(NestedRuntimeException.class));
|
||||
ClassFilter intersection = ClassFilters.intersection(exceptionFilter, hasRootCauseFilter);
|
||||
assertFalse(intersection.matches(RuntimeException.class));
|
||||
assertFalse(intersection.matches(TestBean.class));
|
||||
assertTrue(intersection.matches(NestedRuntimeException.class));
|
||||
assertTrue(intersection.toString().matches("^.+IntersectionClassFilter: \\[.+RootClassFilter: .+Exception, .+RootClassFilter: .+NestedRuntimeException\\]$"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -100,6 +100,14 @@ public class ControlFlowPointcutTests {
|
||||
assertFalse(new ControlFlowPointcut(One.class, "getAge").hashCode() == new ControlFlowPointcut(One.class).hashCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToString() {
|
||||
assertEquals(ControlFlowPointcut.class.getName() + ": class = " + One.class.getName() + "; methodName = null",
|
||||
new ControlFlowPointcut(One.class).toString());
|
||||
assertEquals(ControlFlowPointcut.class.getName() + ": class = " + One.class.getName() + "; methodName = getAge",
|
||||
new ControlFlowPointcut(One.class, "getAge").toString());
|
||||
}
|
||||
|
||||
public class One {
|
||||
int getAge(ITestBean proxied) {
|
||||
return proxied.getAge();
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright 2002-2019 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aop.support;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.aop.ClassFilter;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link RootClassFilter}.
|
||||
*
|
||||
* @author Sam Brannen
|
||||
* @since 5.1.10
|
||||
*/
|
||||
public class RootClassFilterTests {
|
||||
|
||||
private final ClassFilter filter1 = new RootClassFilter(Exception.class);
|
||||
private final ClassFilter filter2 = new RootClassFilter(Exception.class);
|
||||
private final ClassFilter filter3 = new RootClassFilter(ITestBean.class);
|
||||
|
||||
@Test
|
||||
public void matches() {
|
||||
assertTrue(filter1.matches(Exception.class));
|
||||
assertTrue(filter1.matches(RuntimeException.class));
|
||||
assertFalse(filter1.matches(Error.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEquals() {
|
||||
assertEquals(filter1, filter2);
|
||||
assertNotEquals(filter1, filter3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHashCode() {
|
||||
assertEquals(filter1.hashCode(), filter2.hashCode());
|
||||
assertNotEquals(filter1.hashCode(), filter3.hashCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToString() {
|
||||
assertEquals("org.springframework.aop.support.RootClassFilter: java.lang.Exception", filter1.toString());
|
||||
assertEquals(filter1.toString(), filter2.toString());
|
||||
}
|
||||
|
||||
}
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Copyright 2002-2019 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aop.support.annotation;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.aop.ClassFilter;
|
||||
import org.springframework.aop.MethodMatcher;
|
||||
import org.springframework.aop.Pointcut;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link AnnotationMatchingPointcut}.
|
||||
*
|
||||
* @author Sam Brannen
|
||||
* @since 5.1.10
|
||||
*/
|
||||
public class AnnotationMatchingPointcutTests {
|
||||
|
||||
@Test
|
||||
public void classLevelPointcuts() {
|
||||
Pointcut pointcut1 = new AnnotationMatchingPointcut(Qualifier.class, true);
|
||||
Pointcut pointcut2 = new AnnotationMatchingPointcut(Qualifier.class, true);
|
||||
Pointcut pointcut3 = new AnnotationMatchingPointcut(Qualifier.class);
|
||||
|
||||
assertEquals(AnnotationClassFilter.class, pointcut1.getClassFilter().getClass());
|
||||
assertEquals(AnnotationClassFilter.class, pointcut2.getClassFilter().getClass());
|
||||
assertEquals(AnnotationClassFilter.class, pointcut3.getClassFilter().getClass());
|
||||
assertTrue(pointcut1.getClassFilter().toString().contains(Qualifier.class.getName()));
|
||||
|
||||
assertEquals(MethodMatcher.TRUE, pointcut1.getMethodMatcher());
|
||||
assertEquals(MethodMatcher.TRUE, pointcut2.getMethodMatcher());
|
||||
assertEquals(MethodMatcher.TRUE, pointcut3.getMethodMatcher());
|
||||
|
||||
assertEquals(pointcut1, pointcut2);
|
||||
assertNotEquals(pointcut1, pointcut3);
|
||||
assertEquals(pointcut1.hashCode(), pointcut2.hashCode());
|
||||
// #1 and #3 have equivalent hash codes even though equals() returns false.
|
||||
assertEquals(pointcut1.hashCode(), pointcut3.hashCode());
|
||||
assertEquals(pointcut1.toString(), pointcut2.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void methodLevelPointcuts() {
|
||||
Pointcut pointcut1 = new AnnotationMatchingPointcut(null, Qualifier.class, true);
|
||||
Pointcut pointcut2 = new AnnotationMatchingPointcut(null, Qualifier.class, true);
|
||||
Pointcut pointcut3 = new AnnotationMatchingPointcut(null, Qualifier.class);
|
||||
|
||||
assertEquals(ClassFilter.TRUE, pointcut1.getClassFilter());
|
||||
assertEquals(ClassFilter.TRUE, pointcut2.getClassFilter());
|
||||
assertEquals(ClassFilter.TRUE, pointcut3.getClassFilter());
|
||||
assertEquals("ClassFilter.TRUE", pointcut1.getClassFilter().toString());
|
||||
|
||||
assertEquals(AnnotationMethodMatcher.class, pointcut1.getMethodMatcher().getClass());
|
||||
assertEquals(AnnotationMethodMatcher.class, pointcut2.getMethodMatcher().getClass());
|
||||
assertEquals(AnnotationMethodMatcher.class, pointcut3.getMethodMatcher().getClass());
|
||||
|
||||
assertEquals(pointcut1, pointcut2);
|
||||
assertNotEquals(pointcut1, pointcut3);
|
||||
assertEquals(pointcut1.hashCode(), pointcut2.hashCode());
|
||||
// #1 and #3 have equivalent hash codes even though equals() returns false.
|
||||
assertEquals(pointcut1.hashCode(), pointcut3.hashCode());
|
||||
assertEquals(pointcut1.toString(), pointcut2.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void classLevelAndMethodLevelPointcuts() {
|
||||
Pointcut pointcut1 = new AnnotationMatchingPointcut(Qualifier.class, Qualifier.class, true);
|
||||
Pointcut pointcut2 = new AnnotationMatchingPointcut(Qualifier.class, Qualifier.class, true);
|
||||
Pointcut pointcut3 = new AnnotationMatchingPointcut(Qualifier.class, Qualifier.class);
|
||||
|
||||
assertEquals(AnnotationClassFilter.class, pointcut1.getClassFilter().getClass());
|
||||
assertEquals(AnnotationClassFilter.class, pointcut2.getClassFilter().getClass());
|
||||
assertEquals(AnnotationClassFilter.class, pointcut3.getClassFilter().getClass());
|
||||
assertTrue(pointcut1.getClassFilter().toString().contains(Qualifier.class.getName()));
|
||||
|
||||
assertEquals(AnnotationMethodMatcher.class, pointcut1.getMethodMatcher().getClass());
|
||||
assertEquals(AnnotationMethodMatcher.class, pointcut2.getMethodMatcher().getClass());
|
||||
assertEquals(AnnotationMethodMatcher.class, pointcut3.getMethodMatcher().getClass());
|
||||
assertTrue(pointcut1.getMethodMatcher().toString().contains(Qualifier.class.getName()));
|
||||
|
||||
assertEquals(pointcut1, pointcut2);
|
||||
assertNotEquals(pointcut1, pointcut3);
|
||||
assertEquals(pointcut1.hashCode(), pointcut2.hashCode());
|
||||
// #1 and #3 have equivalent hash codes even though equals() returns false.
|
||||
assertEquals(pointcut1.hashCode(), pointcut3.hashCode());
|
||||
assertEquals(pointcut1.toString(), pointcut2.toString());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -89,7 +89,7 @@ dependencies {
|
||||
optional(project(":spring-context-support")) // for JavaMail and JSR-107 support
|
||||
optional(project(":spring-orm")) // for JPA exception translation support
|
||||
optional(project(":spring-tx")) // for JPA, @Transactional support
|
||||
optional("javax.cache:cache-api:1.1.0") // for JCache aspect
|
||||
optional("javax.cache:cache-api:1.1.0") // for JCache aspect
|
||||
optional("javax.transaction:javax.transaction-api:1.3") // for @javax.transaction.Transactional support
|
||||
testCompile(project(":spring-core")) // for CodeStyleAspect
|
||||
testCompile(project(":spring-test"))
|
||||
|
||||
Vendored
+1
@@ -19,6 +19,7 @@ package org.springframework.cache.config;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import javax.cache.annotation.CacheDefaults;
|
||||
import javax.cache.annotation.CacheKey;
|
||||
import javax.cache.annotation.CachePut;
|
||||
|
||||
+1
@@ -17,6 +17,7 @@
|
||||
package org.springframework.transaction.aspectj;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import org.junit.Before;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -554,35 +554,42 @@ public abstract class BeanUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given type represents a "simple" property:
|
||||
* a primitive, a String or other CharSequence, a Number, a Date,
|
||||
* a URI, a URL, a Locale, a Class, or a corresponding array.
|
||||
* Check if the given type represents a "simple" property: a simple value
|
||||
* type or an array of simple value types.
|
||||
* <p>See {@link #isSimpleValueType(Class)} for the definition of <em>simple
|
||||
* value type</em>.
|
||||
* <p>Used to determine properties to check for a "simple" dependency-check.
|
||||
* @param clazz the type to check
|
||||
* @param type the type to check
|
||||
* @return whether the given type represents a "simple" property
|
||||
* @see org.springframework.beans.factory.support.RootBeanDefinition#DEPENDENCY_CHECK_SIMPLE
|
||||
* @see org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory#checkDependencies
|
||||
* @see #isSimpleValueType(Class)
|
||||
*/
|
||||
public static boolean isSimpleProperty(Class<?> clazz) {
|
||||
Assert.notNull(clazz, "Class must not be null");
|
||||
return isSimpleValueType(clazz) || (clazz.isArray() && isSimpleValueType(clazz.getComponentType()));
|
||||
public static boolean isSimpleProperty(Class<?> type) {
|
||||
Assert.notNull(type, "'type' must not be null");
|
||||
return isSimpleValueType(type) || (type.isArray() && isSimpleValueType(type.getComponentType()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given type represents a "simple" value type:
|
||||
* a primitive, an enum, a String or other CharSequence, a Number, a Date,
|
||||
* a URI, a URL, a Locale or a Class.
|
||||
* @param clazz the type to check
|
||||
* Check if the given type represents a "simple" value type: a primitive or
|
||||
* primitive wrapper, an enum, a String or other CharSequence, a Number, a
|
||||
* Date, a URI, a URL, a Locale, or a Class.
|
||||
* <p>{@code Void} and {@code void} are not considered simple value types.
|
||||
* @param type the type to check
|
||||
* @return whether the given type represents a "simple" value type
|
||||
* @see #isSimpleProperty(Class)
|
||||
*/
|
||||
public static boolean isSimpleValueType(Class<?> clazz) {
|
||||
return (ClassUtils.isPrimitiveOrWrapper(clazz) ||
|
||||
Enum.class.isAssignableFrom(clazz) ||
|
||||
CharSequence.class.isAssignableFrom(clazz) ||
|
||||
Number.class.isAssignableFrom(clazz) ||
|
||||
Date.class.isAssignableFrom(clazz) ||
|
||||
URI.class == clazz || URL.class == clazz ||
|
||||
Locale.class == clazz || Class.class == clazz);
|
||||
public static boolean isSimpleValueType(Class<?> type) {
|
||||
return (type != void.class && type != Void.class &&
|
||||
(ClassUtils.isPrimitiveOrWrapper(type) ||
|
||||
Enum.class.isAssignableFrom(type) ||
|
||||
CharSequence.class.isAssignableFrom(type) ||
|
||||
Number.class.isAssignableFrom(type) ||
|
||||
Date.class.isAssignableFrom(type) ||
|
||||
URI.class == type ||
|
||||
URL.class == type ||
|
||||
Locale.class == type ||
|
||||
Class.class == type));
|
||||
}
|
||||
|
||||
|
||||
|
||||
+8
-6
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -139,9 +139,10 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
|
||||
|
||||
|
||||
/**
|
||||
* Create a new AutowiredAnnotationBeanPostProcessor
|
||||
* for Spring's standard {@link Autowired} annotation.
|
||||
* <p>Also supports JSR-330's {@link javax.inject.Inject} annotation, if available.
|
||||
* Create a new {@code AutowiredAnnotationBeanPostProcessor} for Spring's
|
||||
* standard {@link Autowired @Autowired} annotation.
|
||||
* <p>Also supports JSR-330's {@link javax.inject.Inject @Inject} annotation,
|
||||
* if available.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public AutowiredAnnotationBeanPostProcessor() {
|
||||
@@ -242,7 +243,7 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
|
||||
public Constructor<?>[] determineCandidateConstructors(Class<?> beanClass, final String beanName)
|
||||
throws BeanCreationException {
|
||||
|
||||
// Let's check for lookup methods here..
|
||||
// Let's check for lookup methods here...
|
||||
if (!this.lookupMethodsChecked.contains(beanName)) {
|
||||
try {
|
||||
ReflectionUtils.doWithMethods(beanClass, method -> {
|
||||
@@ -251,7 +252,8 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
|
||||
Assert.state(this.beanFactory != null, "No BeanFactory available");
|
||||
LookupOverride override = new LookupOverride(method, lookup.value());
|
||||
try {
|
||||
RootBeanDefinition mbd = (RootBeanDefinition) this.beanFactory.getMergedBeanDefinition(beanName);
|
||||
RootBeanDefinition mbd = (RootBeanDefinition)
|
||||
this.beanFactory.getMergedBeanDefinition(beanName);
|
||||
mbd.getMethodOverrides().addOverride(override);
|
||||
}
|
||||
catch (NoSuchBeanDefinitionException ex) {
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -408,7 +408,7 @@ public class ConstructorArgumentValues {
|
||||
for (Map.Entry<Integer, ValueHolder> entry : this.indexedArgumentValues.entrySet()) {
|
||||
ValueHolder vh1 = entry.getValue();
|
||||
ValueHolder vh2 = that.indexedArgumentValues.get(entry.getKey());
|
||||
if (!vh1.contentEquals(vh2)) {
|
||||
if (vh2 == null || !vh1.contentEquals(vh2)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -17,6 +17,7 @@
|
||||
package org.springframework.beans.factory.config;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.inject.Provider;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
|
||||
+6
-16
@@ -179,8 +179,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
@Nullable
|
||||
private MutablePropertyValues propertyValues;
|
||||
|
||||
@Nullable
|
||||
private MethodOverrides methodOverrides;
|
||||
private MethodOverrides methodOverrides = new MethodOverrides();
|
||||
|
||||
@Nullable
|
||||
private String initMethodName;
|
||||
@@ -869,9 +868,6 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
* <p>Never returns {@code null}.
|
||||
*/
|
||||
public MethodOverrides getMethodOverrides() {
|
||||
if (this.methodOverrides == null) {
|
||||
this.methodOverrides = new MethodOverrides();
|
||||
}
|
||||
return this.methodOverrides;
|
||||
}
|
||||
|
||||
@@ -880,7 +876,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public boolean hasMethodOverrides() {
|
||||
return (this.methodOverrides != null && !this.methodOverrides.isEmpty());
|
||||
return !this.methodOverrides.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1064,10 +1060,9 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
public void validate() throws BeanDefinitionValidationException {
|
||||
if (hasMethodOverrides() && getFactoryMethodName() != null) {
|
||||
throw new BeanDefinitionValidationException(
|
||||
"Cannot combine static factory method with method overrides: " +
|
||||
"the static factory method must create the instance");
|
||||
"Cannot combine factory method with container-generated method overrides: " +
|
||||
"the factory method must create the concrete bean instance.");
|
||||
}
|
||||
|
||||
if (hasBeanClass()) {
|
||||
prepareMethodOverrides();
|
||||
}
|
||||
@@ -1079,14 +1074,9 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
* @throws BeanDefinitionValidationException in case of validation failure
|
||||
*/
|
||||
public void prepareMethodOverrides() throws BeanDefinitionValidationException {
|
||||
// Check that lookup methods exists.
|
||||
// Check that lookup methods exist and determine their overloaded status.
|
||||
if (hasMethodOverrides()) {
|
||||
Set<MethodOverride> overrides = getMethodOverrides().getOverrides();
|
||||
synchronized (overrides) {
|
||||
for (MethodOverride mo : overrides) {
|
||||
prepareMethodOverride(mo);
|
||||
}
|
||||
}
|
||||
getMethodOverrides().getOverrides().forEach(this::prepareMethodOverride);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
@@ -302,6 +302,15 @@ public final class BeanDefinitionBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether this bean is a primary autowire candidate.
|
||||
* @since 5.1.11
|
||||
*/
|
||||
public BeanDefinitionBuilder setPrimary(boolean primary) {
|
||||
this.beanDefinition.setPrimary(primary);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the role of this definition.
|
||||
*/
|
||||
|
||||
+1
-1
@@ -249,7 +249,7 @@ public class CglibSubclassingInstantiationStrategy extends SimpleInstantiationSt
|
||||
public int accept(Method method) {
|
||||
MethodOverride methodOverride = getBeanDefinition().getMethodOverrides().getOverride(method);
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Override for '" + method.getName() + "' is [" + methodOverride + "]");
|
||||
logger.trace("MethodOverride for " + method + ": " + methodOverride);
|
||||
}
|
||||
if (methodOverride == null) {
|
||||
return PASSTHROUGH;
|
||||
|
||||
+6
-2
@@ -43,6 +43,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.inject.Provider;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -321,7 +322,8 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
this.allowEagerClassLoading = otherListableFactory.allowEagerClassLoading;
|
||||
this.dependencyComparator = otherListableFactory.dependencyComparator;
|
||||
// A clone of the AutowireCandidateResolver since it is potentially BeanFactoryAware...
|
||||
setAutowireCandidateResolver(BeanUtils.instantiateClass(getAutowireCandidateResolver().getClass()));
|
||||
setAutowireCandidateResolver(
|
||||
BeanUtils.instantiateClass(otherListableFactory.getAutowireCandidateResolver().getClass()));
|
||||
// Make resolvable dependencies (e.g. ResourceLoader) available here as well...
|
||||
this.resolvableDependencies.putAll(otherListableFactory.resolvableDependencies);
|
||||
}
|
||||
@@ -1002,7 +1004,9 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
for (String bdName : this.beanDefinitionNames) {
|
||||
if (!beanName.equals(bdName)) {
|
||||
BeanDefinition bd = this.beanDefinitionMap.get(bdName);
|
||||
if (beanName.equals(bd.getParentName())) {
|
||||
// Ensure bd is non-null due to potential concurrent modification
|
||||
// of the beanDefinitionMap.
|
||||
if (bd != null && beanName.equals(bd.getParentName())) {
|
||||
resetBeanDefinition(bdName);
|
||||
}
|
||||
}
|
||||
|
||||
+10
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -18,6 +18,7 @@ package org.springframework.beans.factory.support;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
* GenericBeanDefinition is a one-stop shop for standard bean definition purposes.
|
||||
@@ -84,7 +85,14 @@ public class GenericBeanDefinition extends AbstractBeanDefinition {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
return (this == other || (other instanceof GenericBeanDefinition && super.equals(other)));
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof GenericBeanDefinition)) {
|
||||
return false;
|
||||
}
|
||||
GenericBeanDefinition that = (GenericBeanDefinition) other;
|
||||
return (ObjectUtils.nullSafeEquals(this.parentName, that.parentName) && super.equals(other));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+9
-21
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -17,9 +17,8 @@
|
||||
package org.springframework.beans.factory.support;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
@@ -37,9 +36,7 @@ import org.springframework.lang.Nullable;
|
||||
*/
|
||||
public class MethodOverrides {
|
||||
|
||||
private final Set<MethodOverride> overrides = Collections.synchronizedSet(new LinkedHashSet<>(2));
|
||||
|
||||
private volatile boolean modified = false;
|
||||
private final Set<MethodOverride> overrides = new CopyOnWriteArraySet<>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -61,7 +58,6 @@ public class MethodOverrides {
|
||||
*/
|
||||
public void addOverrides(@Nullable MethodOverrides other) {
|
||||
if (other != null) {
|
||||
this.modified = true;
|
||||
this.overrides.addAll(other.overrides);
|
||||
}
|
||||
}
|
||||
@@ -70,7 +66,6 @@ public class MethodOverrides {
|
||||
* Add the given method override.
|
||||
*/
|
||||
public void addOverride(MethodOverride override) {
|
||||
this.modified = true;
|
||||
this.overrides.add(override);
|
||||
}
|
||||
|
||||
@@ -80,7 +75,6 @@ public class MethodOverrides {
|
||||
* @see MethodOverride
|
||||
*/
|
||||
public Set<MethodOverride> getOverrides() {
|
||||
this.modified = true;
|
||||
return this.overrides;
|
||||
}
|
||||
|
||||
@@ -88,7 +82,7 @@ public class MethodOverrides {
|
||||
* Return whether the set of method overrides is empty.
|
||||
*/
|
||||
public boolean isEmpty() {
|
||||
return (!this.modified || this.overrides.isEmpty());
|
||||
return this.overrides.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,18 +92,13 @@ public class MethodOverrides {
|
||||
*/
|
||||
@Nullable
|
||||
public MethodOverride getOverride(Method method) {
|
||||
if (!this.modified) {
|
||||
return null;
|
||||
}
|
||||
synchronized (this.overrides) {
|
||||
MethodOverride match = null;
|
||||
for (MethodOverride candidate : this.overrides) {
|
||||
if (candidate.matches(method)) {
|
||||
match = candidate;
|
||||
}
|
||||
MethodOverride match = null;
|
||||
for (MethodOverride candidate : this.overrides) {
|
||||
if (candidate.matches(method)) {
|
||||
match = candidate;
|
||||
}
|
||||
return match;
|
||||
}
|
||||
return match;
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +112,6 @@ public class MethodOverrides {
|
||||
}
|
||||
MethodOverrides that = (MethodOverrides) other;
|
||||
return this.overrides.equals(that.overrides);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
@@ -20,6 +20,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -19,8 +19,14 @@ package org.springframework.beans;
|
||||
import java.beans.Introspector;
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.time.DayOfWeek;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -32,7 +38,12 @@ import org.springframework.tests.sample.beans.DerivedTestBean;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link BeanUtils}.
|
||||
@@ -40,6 +51,7 @@ import static org.junit.Assert.*;
|
||||
* @author Juergen Hoeller
|
||||
* @author Rob Harrop
|
||||
* @author Chris Beams
|
||||
* @author Sam Brannen
|
||||
* @since 19.05.2003
|
||||
*/
|
||||
public class BeanUtilsTests {
|
||||
@@ -275,6 +287,60 @@ public class BeanUtilsTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSimpleValueType() {
|
||||
Stream.of(
|
||||
|
||||
boolean.class, char.class, byte.class, short.class, int.class,
|
||||
long.class, float.class, double.class,
|
||||
|
||||
Boolean.class, Character.class, Byte.class, Short.class, Integer.class,
|
||||
Long.class, Float.class, Double.class,
|
||||
|
||||
DayOfWeek.class, String.class, Date.class, URI.class, URL.class, Locale.class, Class.class
|
||||
|
||||
).forEach(this::assertIsSimpleValueType);
|
||||
|
||||
Stream.of(int[].class, Object.class, List.class, void.class, Void.class)
|
||||
.forEach(this::assertIsNotSimpleValueType);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSimpleProperty() {
|
||||
Stream.of(
|
||||
|
||||
boolean.class, char.class, byte.class, short.class, int.class,
|
||||
long.class, float.class, double.class,
|
||||
|
||||
Boolean.class, Character.class, Byte.class, Short.class, Integer.class,
|
||||
Long.class, Float.class, Double.class,
|
||||
|
||||
DayOfWeek.class, String.class, Date.class, URI.class, URL.class, Locale.class, Class.class,
|
||||
|
||||
boolean[].class, Boolean[].class, Date[].class
|
||||
|
||||
).forEach(this::assertIsSimpleProperty);
|
||||
|
||||
Stream.of(Object.class, List.class, void.class, Void.class)
|
||||
.forEach(this::assertIsNotSimpleProperty);
|
||||
}
|
||||
|
||||
private void assertIsSimpleValueType(Class<?> type) {
|
||||
assertTrue("Type [" + type.getName() + "] should be a simple value type", BeanUtils.isSimpleValueType(type));
|
||||
}
|
||||
|
||||
private void assertIsNotSimpleValueType(Class<?> type) {
|
||||
assertFalse("Type [" + type.getName() + "] should not be a simple value type", BeanUtils.isSimpleValueType(type));
|
||||
}
|
||||
|
||||
private void assertIsSimpleProperty(Class<?> type) {
|
||||
assertTrue("Type [" + type.getName() + "] should be a simple property", BeanUtils.isSimpleProperty(type));
|
||||
}
|
||||
|
||||
private void assertIsNotSimpleProperty(Class<?> type) {
|
||||
assertFalse("Type [" + type.getName() + "] should not be a simple property", BeanUtils.isSimpleProperty(type));
|
||||
}
|
||||
|
||||
private void assertSignatureEquals(Method desiredMethod, String signature) {
|
||||
assertEquals(desiredMethod, BeanUtils.resolveSignature(signature, MethodSignatureBean.class));
|
||||
}
|
||||
@@ -445,6 +511,7 @@ public class BeanUtilsTests {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class BeanWithSingleNonDefaultConstructor {
|
||||
|
||||
private final String name;
|
||||
|
||||
+62
-22
@@ -38,6 +38,8 @@ import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import javax.annotation.Priority;
|
||||
import javax.security.auth.Subject;
|
||||
|
||||
@@ -792,6 +794,18 @@ public class DefaultListableBeanFactoryTests {
|
||||
lbf.registerAlias("test", "test3");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAliasChaining() {
|
||||
lbf.registerBeanDefinition("test", new RootBeanDefinition(NestedTestBean.class));
|
||||
lbf.registerAlias("test", "testAlias");
|
||||
lbf.registerAlias("testAlias", "testAlias2");
|
||||
lbf.registerAlias("testAlias2", "testAlias3");
|
||||
Object bean = lbf.getBean("test");
|
||||
assertSame(bean, lbf.getBean("testAlias"));
|
||||
assertSame(bean, lbf.getBean("testAlias2"));
|
||||
assertSame(bean, lbf.getBean("testAlias3"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBeanDefinitionOverriding() {
|
||||
lbf.registerBeanDefinition("test", new RootBeanDefinition(TestBean.class));
|
||||
@@ -802,20 +816,6 @@ public class DefaultListableBeanFactoryTests {
|
||||
assertTrue(lbf.getBean("test2") instanceof NestedTestBean);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBeanDefinitionRemoval() {
|
||||
lbf.setAllowBeanDefinitionOverriding(false);
|
||||
lbf.registerBeanDefinition("test", new RootBeanDefinition(TestBean.class));
|
||||
lbf.registerAlias("test", "test2");
|
||||
lbf.preInstantiateSingletons();
|
||||
lbf.removeBeanDefinition("test");
|
||||
lbf.removeAlias("test2");
|
||||
lbf.registerBeanDefinition("test", new RootBeanDefinition(NestedTestBean.class));
|
||||
lbf.registerAlias("test", "test2");
|
||||
assertTrue(lbf.getBean("test") instanceof NestedTestBean);
|
||||
assertTrue(lbf.getBean("test2") instanceof NestedTestBean);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBeanDefinitionOverridingNotAllowed() {
|
||||
lbf.setAllowBeanDefinitionOverriding(false);
|
||||
@@ -844,15 +844,55 @@ public class DefaultListableBeanFactoryTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAliasChaining() {
|
||||
public void beanDefinitionOverridingWithConstructorArgumentMismatch() {
|
||||
RootBeanDefinition bd1 = new RootBeanDefinition(NestedTestBean.class);
|
||||
bd1.getConstructorArgumentValues().addIndexedArgumentValue(1, "value1");
|
||||
lbf.registerBeanDefinition("test", bd1);
|
||||
RootBeanDefinition bd2 = new RootBeanDefinition(NestedTestBean.class);
|
||||
bd2.getConstructorArgumentValues().addIndexedArgumentValue(0, "value0");
|
||||
lbf.registerBeanDefinition("test", bd2);
|
||||
assertTrue(lbf.getBean("test") instanceof NestedTestBean);
|
||||
assertEquals("value0", lbf.getBean("test", NestedTestBean.class).getCompany());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBeanDefinitionRemoval() {
|
||||
lbf.setAllowBeanDefinitionOverriding(false);
|
||||
lbf.registerBeanDefinition("test", new RootBeanDefinition(TestBean.class));
|
||||
lbf.registerAlias("test", "test2");
|
||||
lbf.preInstantiateSingletons();
|
||||
lbf.removeBeanDefinition("test");
|
||||
lbf.removeAlias("test2");
|
||||
lbf.registerBeanDefinition("test", new RootBeanDefinition(NestedTestBean.class));
|
||||
lbf.registerAlias("test", "testAlias");
|
||||
lbf.registerAlias("testAlias", "testAlias2");
|
||||
lbf.registerAlias("testAlias2", "testAlias3");
|
||||
Object bean = lbf.getBean("test");
|
||||
assertSame(bean, lbf.getBean("testAlias"));
|
||||
assertSame(bean, lbf.getBean("testAlias2"));
|
||||
assertSame(bean, lbf.getBean("testAlias3"));
|
||||
lbf.registerAlias("test", "test2");
|
||||
assertTrue(lbf.getBean("test") instanceof NestedTestBean);
|
||||
assertTrue(lbf.getBean("test2") instanceof NestedTestBean);
|
||||
}
|
||||
|
||||
@Test // gh-23542
|
||||
public void concurrentBeanDefinitionRemoval() {
|
||||
final int MAX = 200;
|
||||
lbf.setAllowBeanDefinitionOverriding(false);
|
||||
|
||||
// Register the bean definitions before invoking preInstantiateSingletons()
|
||||
// to simulate realistic usage of an ApplicationContext; otherwise, the bean
|
||||
// factory thinks it's an "empty" factory which causes this test to fail in
|
||||
// an unrealistic manner.
|
||||
IntStream.range(0, MAX).forEach(this::registerTestBean);
|
||||
lbf.preInstantiateSingletons();
|
||||
|
||||
// This test is considered successful if the following does not result in an exception.
|
||||
IntStream.range(0, MAX).parallel().forEach(this::removeTestBean);
|
||||
}
|
||||
|
||||
private void registerTestBean(int i) {
|
||||
String name = "test" + i;
|
||||
lbf.registerBeanDefinition(name, new RootBeanDefinition(TestBean.class));
|
||||
}
|
||||
|
||||
private void removeTestBean(int i) {
|
||||
String name = "test" + i;
|
||||
lbf.removeBeanDefinition(name);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+1
@@ -22,6 +22,7 @@ import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Provider;
|
||||
|
||||
+1
@@ -17,6 +17,7 @@
|
||||
package org.springframework.beans.factory.config;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.inject.Provider;
|
||||
|
||||
import org.junit.After;
|
||||
|
||||
+1
@@ -18,6 +18,7 @@ package org.springframework.beans.factory.serviceloader;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
+22
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -100,6 +100,27 @@ public class BeanDefinitionTests {
|
||||
assertTrue(bd.hashCode() == otherBd.hashCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void genericBeanDefinitionEquality() {
|
||||
GenericBeanDefinition bd = new GenericBeanDefinition();
|
||||
bd.setParentName("parent");
|
||||
bd.setScope("request");
|
||||
bd.setAbstract(true);
|
||||
bd.setLazyInit(true);
|
||||
GenericBeanDefinition otherBd = new GenericBeanDefinition();
|
||||
otherBd.setScope("request");
|
||||
otherBd.setAbstract(true);
|
||||
otherBd.setLazyInit(true);
|
||||
boolean condition1 = !bd.equals(otherBd);
|
||||
assertTrue(condition1);
|
||||
boolean condition = !otherBd.equals(bd);
|
||||
assertTrue(condition);
|
||||
otherBd.setParentName("parent");
|
||||
assertTrue(bd.equals(otherBd));
|
||||
assertTrue(otherBd.equals(bd));
|
||||
assertTrue(bd.hashCode() == otherBd.hashCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void beanDefinitionHolderEquality() {
|
||||
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
|
||||
|
||||
+1
@@ -28,6 +28,7 @@ import java.security.PrivilegedExceptionAction;
|
||||
import java.security.ProtectionDomain;
|
||||
import java.util.PropertyPermission;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.security.auth.AuthPermission;
|
||||
import javax.security.auth.Subject;
|
||||
|
||||
|
||||
+1
@@ -23,6 +23,7 @@ import java.util.EnumSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.processing.Completion;
|
||||
import javax.annotation.processing.ProcessingEnvironment;
|
||||
import javax.annotation.processing.Processor;
|
||||
|
||||
+1
@@ -19,6 +19,7 @@ package org.springframework.context.index.processor;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.lang.model.element.AnnotationMirror;
|
||||
import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.ElementKind;
|
||||
|
||||
+1
@@ -20,6 +20,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.processing.ProcessingEnvironment;
|
||||
import javax.annotation.processing.RoundEnvironment;
|
||||
import javax.lang.model.element.Element;
|
||||
|
||||
+1
@@ -19,6 +19,7 @@ package org.springframework.context.index.processor;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import javax.annotation.processing.ProcessingEnvironment;
|
||||
import javax.tools.FileObject;
|
||||
import javax.tools.StandardLocation;
|
||||
|
||||
+1
@@ -18,6 +18,7 @@ package org.springframework.context.index.processor;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.ElementKind;
|
||||
|
||||
|
||||
+1
@@ -18,6 +18,7 @@ package org.springframework.context.index.processor;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.lang.model.element.AnnotationMirror;
|
||||
import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.ElementKind;
|
||||
|
||||
+1
@@ -17,6 +17,7 @@
|
||||
package org.springframework.context.index.processor;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.lang.model.element.Element;
|
||||
|
||||
/**
|
||||
|
||||
+1
@@ -19,6 +19,7 @@ package org.springframework.context.index.processor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.processing.ProcessingEnvironment;
|
||||
import javax.lang.model.element.AnnotationMirror;
|
||||
import javax.lang.model.element.Element;
|
||||
|
||||
+2
-1
@@ -19,6 +19,7 @@ package org.springframework.context.index.processor;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.annotation.ManagedBean;
|
||||
import javax.inject.Named;
|
||||
import javax.persistence.Converter;
|
||||
@@ -37,6 +38,7 @@ import org.springframework.context.index.sample.AbstractController;
|
||||
import org.springframework.context.index.sample.MetaControllerIndexed;
|
||||
import org.springframework.context.index.sample.SampleComponent;
|
||||
import org.springframework.context.index.sample.SampleController;
|
||||
import org.springframework.context.index.sample.SampleEmbedded;
|
||||
import org.springframework.context.index.sample.SampleMetaController;
|
||||
import org.springframework.context.index.sample.SampleMetaIndexedController;
|
||||
import org.springframework.context.index.sample.SampleNonStaticEmbedded;
|
||||
@@ -48,7 +50,6 @@ import org.springframework.context.index.sample.cdi.SampleNamed;
|
||||
import org.springframework.context.index.sample.cdi.SampleTransactional;
|
||||
import org.springframework.context.index.sample.jpa.SampleConverter;
|
||||
import org.springframework.context.index.sample.jpa.SampleEmbeddable;
|
||||
import org.springframework.context.index.sample.SampleEmbedded;
|
||||
import org.springframework.context.index.sample.jpa.SampleEntity;
|
||||
import org.springframework.context.index.sample.jpa.SampleMappedSuperClass;
|
||||
import org.springframework.context.index.sample.type.Repo;
|
||||
|
||||
+1
@@ -22,6 +22,7 @@ import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.processing.Processor;
|
||||
import javax.tools.JavaCompiler;
|
||||
import javax.tools.JavaFileObject;
|
||||
|
||||
+1
@@ -17,6 +17,7 @@
|
||||
package org.springframework.cache.jcache;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import javax.cache.Cache;
|
||||
import javax.cache.processor.EntryProcessor;
|
||||
import javax.cache.processor.EntryProcessorException;
|
||||
|
||||
Vendored
+1
@@ -18,6 +18,7 @@ package org.springframework.cache.jcache;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
import javax.cache.CacheManager;
|
||||
import javax.cache.Caching;
|
||||
|
||||
|
||||
Vendored
+1
@@ -18,6 +18,7 @@ package org.springframework.cache.jcache;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.cache.CacheManager;
|
||||
import javax.cache.Caching;
|
||||
|
||||
|
||||
+1
@@ -19,6 +19,7 @@ package org.springframework.cache.jcache.interceptor;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.cache.annotation.CacheInvocationParameter;
|
||||
import javax.cache.annotation.CacheMethodDetails;
|
||||
|
||||
|
||||
+1
@@ -24,6 +24,7 @@ import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.cache.annotation.CacheInvocationParameter;
|
||||
import javax.cache.annotation.CacheKey;
|
||||
import javax.cache.annotation.CacheMethodDetails;
|
||||
|
||||
+1
@@ -17,6 +17,7 @@
|
||||
package org.springframework.cache.jcache.interceptor;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
import javax.cache.annotation.CacheKeyInvocationContext;
|
||||
|
||||
import org.springframework.cache.interceptor.CacheErrorHandler;
|
||||
|
||||
+1
@@ -20,6 +20,7 @@ import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.cache.annotation.CacheDefaults;
|
||||
import javax.cache.annotation.CacheKeyGenerator;
|
||||
import javax.cache.annotation.CacheMethodDetails;
|
||||
|
||||
+1
@@ -18,6 +18,7 @@ package org.springframework.cache.jcache.interceptor;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
import javax.cache.annotation.CacheInvocationParameter;
|
||||
import javax.cache.annotation.CacheMethodDetails;
|
||||
import javax.cache.annotation.CachePut;
|
||||
|
||||
+1
@@ -18,6 +18,7 @@ package org.springframework.cache.jcache.interceptor;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import javax.cache.annotation.CacheInvocationContext;
|
||||
|
||||
import org.springframework.cache.Cache;
|
||||
|
||||
+1
@@ -20,6 +20,7 @@ import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.cache.annotation.CacheInvocationContext;
|
||||
import javax.cache.annotation.CacheInvocationParameter;
|
||||
|
||||
|
||||
+1
@@ -17,6 +17,7 @@
|
||||
package org.springframework.cache.jcache.interceptor;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
import javax.cache.annotation.CacheInvocationParameter;
|
||||
import javax.cache.annotation.CacheKeyInvocationContext;
|
||||
|
||||
|
||||
+1
@@ -22,6 +22,7 @@ import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.cache.annotation.CacheMethodDetails;
|
||||
|
||||
/**
|
||||
|
||||
+1
@@ -17,6 +17,7 @@
|
||||
package org.springframework.cache.jcache.interceptor;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
import javax.cache.annotation.CacheInvocationParameter;
|
||||
import javax.cache.annotation.CacheMethodDetails;
|
||||
|
||||
|
||||
+1
@@ -20,6 +20,7 @@ import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.cache.annotation.CacheInvocationParameter;
|
||||
import javax.cache.annotation.CacheKeyGenerator;
|
||||
import javax.cache.annotation.CacheKeyInvocationContext;
|
||||
|
||||
+1
@@ -19,6 +19,7 @@ package org.springframework.mail.javamail;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.activation.FileTypeMap;
|
||||
import javax.activation.MimetypesFileTypeMap;
|
||||
|
||||
|
||||
+1
@@ -17,6 +17,7 @@
|
||||
package org.springframework.mail.javamail;
|
||||
|
||||
import java.beans.PropertyEditorSupport;
|
||||
|
||||
import javax.mail.internet.AddressException;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
|
||||
|
||||
+1
@@ -17,6 +17,7 @@
|
||||
package org.springframework.mail.javamail;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.mail.internet.MimeMessage;
|
||||
|
||||
import org.springframework.mail.MailException;
|
||||
|
||||
+1
@@ -23,6 +23,7 @@ import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.activation.FileTypeMap;
|
||||
import javax.mail.Address;
|
||||
import javax.mail.AuthenticationFailedException;
|
||||
|
||||
+1
@@ -17,6 +17,7 @@
|
||||
package org.springframework.mail.javamail;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
|
||||
|
||||
+1
@@ -22,6 +22,7 @@ import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.activation.DataHandler;
|
||||
import javax.activation.DataSource;
|
||||
import javax.activation.FileDataSource;
|
||||
|
||||
+1
@@ -18,6 +18,7 @@ package org.springframework.scheduling.commonj;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.naming.NamingException;
|
||||
|
||||
import commonj.timers.Timer;
|
||||
|
||||
+1
@@ -20,6 +20,7 @@ import java.util.Collection;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.FutureTask;
|
||||
|
||||
import javax.naming.NamingException;
|
||||
|
||||
import commonj.work.Work;
|
||||
|
||||
+1
@@ -18,6 +18,7 @@ package org.springframework.scheduling.quartz;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.quartz.SchedulerConfigException;
|
||||
|
||||
+1
@@ -21,6 +21,7 @@ import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.quartz.Scheduler;
|
||||
|
||||
Vendored
+1
@@ -18,6 +18,7 @@ package org.springframework.cache.jcache;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.cache.Cache;
|
||||
import javax.cache.CacheManager;
|
||||
|
||||
|
||||
+1
@@ -18,6 +18,7 @@ package org.springframework.cache.jcache.interceptor;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import javax.cache.annotation.CacheInvocationParameter;
|
||||
import javax.cache.annotation.CacheMethodDetails;
|
||||
|
||||
|
||||
+1
@@ -19,6 +19,7 @@ package org.springframework.cache.jcache.interceptor;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import javax.cache.annotation.CacheDefaults;
|
||||
import javax.cache.annotation.CacheKey;
|
||||
import javax.cache.annotation.CachePut;
|
||||
|
||||
+1
@@ -18,6 +18,7 @@ package org.springframework.cache.jcache.interceptor;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Comparator;
|
||||
|
||||
import javax.cache.annotation.CacheDefaults;
|
||||
import javax.cache.annotation.CacheKeyGenerator;
|
||||
import javax.cache.annotation.CacheRemove;
|
||||
|
||||
+1
@@ -17,6 +17,7 @@
|
||||
package org.springframework.cache.jcache.interceptor;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.cache.annotation.CacheInvocationParameter;
|
||||
import javax.cache.annotation.CacheMethodDetails;
|
||||
import javax.cache.annotation.CachePut;
|
||||
|
||||
+1
@@ -19,6 +19,7 @@ package org.springframework.cache.jcache.interceptor;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.cache.annotation.CacheInvocationContext;
|
||||
import javax.cache.annotation.CacheMethodDetails;
|
||||
import javax.cache.annotation.CacheResolver;
|
||||
|
||||
+1
@@ -19,6 +19,7 @@ package org.springframework.cache.jcache.interceptor;
|
||||
import java.io.IOException;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.cache.annotation.CacheInvocationParameter;
|
||||
import javax.cache.annotation.CacheKey;
|
||||
import javax.cache.annotation.CacheMethodDetails;
|
||||
|
||||
+1
@@ -18,6 +18,7 @@ package org.springframework.cache.jcache.interceptor;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import javax.cache.annotation.CacheDefaults;
|
||||
import javax.cache.annotation.CachePut;
|
||||
import javax.cache.annotation.CacheRemove;
|
||||
|
||||
+1
@@ -19,6 +19,7 @@ package org.springframework.cache.jcache.interceptor;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import javax.cache.annotation.CacheDefaults;
|
||||
import javax.cache.annotation.CacheKey;
|
||||
import javax.cache.annotation.CacheResult;
|
||||
|
||||
+1
@@ -1,6 +1,7 @@
|
||||
package org.springframework.cache.jcache.support;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
import javax.cache.annotation.CacheKeyGenerator;
|
||||
import javax.cache.annotation.CacheKeyInvocationContext;
|
||||
import javax.cache.annotation.GeneratedCacheKey;
|
||||
|
||||
+1
@@ -17,6 +17,7 @@
|
||||
package org.springframework.cache.jcache.support;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
import javax.cache.Cache;
|
||||
import javax.cache.annotation.CacheInvocationContext;
|
||||
import javax.cache.annotation.CacheResolver;
|
||||
|
||||
+1
@@ -17,6 +17,7 @@
|
||||
package org.springframework.cache.jcache.support;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
import javax.cache.annotation.CacheMethodDetails;
|
||||
import javax.cache.annotation.CacheResolver;
|
||||
import javax.cache.annotation.CacheResolverFactory;
|
||||
|
||||
+1
@@ -23,6 +23,7 @@ import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.activation.FileTypeMap;
|
||||
import javax.mail.Address;
|
||||
import javax.mail.Message;
|
||||
|
||||
+1
@@ -18,6 +18,7 @@ package org.springframework.scheduling.quartz;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
+1
@@ -18,6 +18,7 @@ package org.springframework.validation.beanvalidation2;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
import javax.validation.Validator;
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
+1
@@ -33,6 +33,7 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
|
||||
+1
@@ -27,6 +27,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
|
||||
@@ -19,7 +19,7 @@ dependencies {
|
||||
optional("org.aspectj:aspectjweaver:${aspectjVersion}")
|
||||
optional("org.codehaus.groovy:groovy:${groovyVersion}")
|
||||
optional("org.beanshell:bsh:2.0b5")
|
||||
optional("joda-time:joda-time:2.10.1")
|
||||
optional("joda-time:joda-time:2.10.4")
|
||||
optional("org.hibernate:hibernate-validator:5.4.3.Final")
|
||||
optional("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
|
||||
optional("org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}")
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user