diff --git a/spring-beans/src/main/java/org/springframework/beans/BeanUtils.java b/spring-beans/src/main/java/org/springframework/beans/BeanUtils.java index aacf3e2b6560..98e646e56421 100644 --- a/spring-beans/src/main/java/org/springframework/beans/BeanUtils.java +++ b/spring-beans/src/main/java/org/springframework/beans/BeanUtils.java @@ -47,7 +47,7 @@ * *

Mainly for use within the framework, but to some degree also * useful for application classes. - * + * * @author Rod Johnson * @author Juergen Hoeller * @author Rob Harrop diff --git a/spring-beans/src/main/java/org/springframework/beans/annotation/AnnotationBeanUtils.java b/spring-beans/src/main/java/org/springframework/beans/annotation/AnnotationBeanUtils.java index 55dca06c3028..539dcae6ff75 100644 --- a/spring-beans/src/main/java/org/springframework/beans/annotation/AnnotationBeanUtils.java +++ b/spring-beans/src/main/java/org/springframework/beans/annotation/AnnotationBeanUtils.java @@ -29,6 +29,8 @@ /** * General utility methods for working with annotations in JavaBeans style. + * + *

通用工具方法,工作在有annotation的JavaBeans style类 * * @author Rob Harrop * @author Juergen Hoeller @@ -39,6 +41,8 @@ public abstract class AnnotationBeanUtils { /** * Copy the properties of the supplied {@link Annotation} to the supplied target bean. * Any properties defined in {@code excludedProperties} will not be copied. + * + *

根据提供的Annotation负责属性给目标对象bean,排除excludedProperties包括的属性 * @param ann the annotation to copy from * @param bean the bean instance to copy to * @param excludedProperties the names of excluded properties, if any diff --git a/spring-core/src/main/java/org/springframework/cglib/core/SpringNamingPolicy.java b/spring-core/src/main/java/org/springframework/cglib/core/SpringNamingPolicy.java index 839f36f8b37d..56cc8d315ecf 100644 --- a/spring-core/src/main/java/org/springframework/cglib/core/SpringNamingPolicy.java +++ b/spring-core/src/main/java/org/springframework/cglib/core/SpringNamingPolicy.java @@ -23,7 +23,7 @@ *

This is primarily designed to avoid clashes between a regular CGLIB * version (used by some other library) and Spring's embedded variant, * in case the same class happens to get proxied for different purposes. - * + *

CGLIB's DefaultNamingPolicy通用扩展 * @author Juergen Hoeller * @since 3.2.8 */ diff --git a/spring-core/src/main/java/org/springframework/core/Constants.java b/spring-core/src/main/java/org/springframework/core/Constants.java index 16df5584b3e1..1b967191faf3 100644 --- a/spring-core/src/main/java/org/springframework/core/Constants.java +++ b/spring-core/src/main/java/org/springframework/core/Constants.java @@ -39,22 +39,27 @@ * recognize the same names as the constants themselves, and freeing them * from maintaining their own mapping. * + *

该类可以用于parse其他类存在的public static final 定义的常量 ,该类的 {@code asXXXX}方法 + * 允许通过string name访问常量值 + *

该类在PropertyEditors使用,可以让他们识别相同的name作为常量,可以释放他们从维护自己的映射中 + * * @author Rod Johnson * @author Juergen Hoeller * @since 16.03.2003 */ public class Constants { - /** The name of the introspected class */ + /** The name of the introspected class 要parse的类的类名 */ private final String className; - /** Map from String field name to object value */ + /** Map from String field name to object value sting字段名对应于对象的值 */ private final Map fieldCache = new HashMap<>(); /** * Create a new Constants converter class wrapping the given class. *

All public static final variables will be exposed, whatever their type. + * 创建一个常量转换类wrapper给定的类, * @param clazz the class to analyze * @throws IllegalArgumentException if the supplied {@code clazz} is {@code null} */ @@ -79,6 +84,7 @@ public Constants(Class clazz) { /** * Return the name of the analyzed class. + * 返回这个分析类的名称 */ public final String getClassName() { return this.className; @@ -86,6 +92,7 @@ public final String getClassName() { /** * Return the number of constants exposed. + * 暴露的类的常量数 */ public final int getSize() { return this.fieldCache.size(); @@ -94,6 +101,8 @@ public final int getSize() { /** * Exposes the field cache to subclasses: * a Map from String field name to object value. + * + * 暴露类的字段缓存 */ protected final Map getFieldCache() { return this.fieldCache; @@ -102,6 +111,7 @@ protected final Map getFieldCache() { /** * Return a constant value cast to a Number. + * 返回常量值转换为Number * @param code the name of the field (never {@code null}) * @return the Number value * @see #asObject @@ -118,6 +128,7 @@ public Number asNumber(String code) throws ConstantException { /** * Return a constant value as a String. + * 返回常量值转换为String * @param code the name of the field (never {@code null}) * @return the String value * Works even if it's not a string (invokes {@code toString()}). @@ -132,6 +143,8 @@ public String asString(String code) throws ConstantException { * Parse the given String (upper or lower case accepted) and return * the appropriate value if it's the name of a constant field in the * class that we're analysing. + * + * 返回常量值转换为Object * @param code the name of the field (never {@code null}) * @return the Object value * @throws ConstantException if there's no such field @@ -154,6 +167,8 @@ public Object asObject(String code) throws ConstantException { * values (i.e. all uppercase). The supplied {@code namePrefix} * will be uppercased (in a locale-insensitive fashion) prior to * the main logic of this method kicking in. + * + * 返回所有常量的名称根据前缀 * @param namePrefix prefix of the constant names to search (may be {@code null}) * @return the set of constant names */ @@ -171,6 +186,7 @@ public Set getNames(String namePrefix) { /** * Return all names of the group of constants for the * given bean property name. + * 返回所有常量名,根据给定bean属性的名称 * @param propertyName the name of the bean property * @return the set of values * @see #propertyToConstantNamePrefix @@ -181,6 +197,8 @@ public Set getNamesForProperty(String propertyName) { /** * Return all names of the given group of constants. + * + * 根据后缀返回给定常量名 *

Note that this method assumes that constants are named * in accordance with the standard Java convention for constant * values (i.e. all uppercase). The supplied {@code nameSuffix} @@ -203,6 +221,7 @@ public Set getNamesForSuffix(String nameSuffix) { /** * Return all values of the given group of constants. + * 根据前缀返回所有常量值 *

Note that this method assumes that constants are named * in accordance with the standard Java convention for constant * values (i.e. all uppercase). The supplied {@code namePrefix} @@ -225,6 +244,7 @@ public Set getValues(String namePrefix) { /** * Return all values of the group of constants for the * given bean property name. + * 返回所有常量值,根据给定bean属性的名称 * @param propertyName the name of the bean property * @return the set of values * @see #propertyToConstantNamePrefix @@ -235,6 +255,7 @@ public Set getValuesForProperty(String propertyName) { /** * Return all values of the given group of constants. + * 根据前缀获取常量值 *

Note that this method assumes that constants are named * in accordance with the standard Java convention for constant * values (i.e. all uppercase). The supplied {@code nameSuffix} @@ -257,6 +278,7 @@ public Set getValuesForSuffix(String nameSuffix) { /** * Look up the given value within the given group of constants. + * 根据前缀查找给定值和属性名key *

Will return the first match. * @param value constant value to look up * @param namePrefix prefix of the constant names to search (may be {@code null}) @@ -288,7 +310,9 @@ public String toCodeForProperty(Object value, String propertyName) throws Consta /** * Look up the given value within the given group of constants. + * *

Will return the first match. + * 根据后缀查找给定值和属性名key * @param value constant value to look up * @param nameSuffix suffix of the constant names to search (may be {@code null}) * @return the name of the constant field diff --git a/spring-core/src/main/java/org/springframework/core/ControlFlow.java b/spring-core/src/main/java/org/springframework/core/ControlFlow.java index a650c6cb400a..9010f4a5f1b8 100644 --- a/spring-core/src/main/java/org/springframework/core/ControlFlow.java +++ b/spring-core/src/main/java/org/springframework/core/ControlFlow.java @@ -20,7 +20,7 @@ * Interface to be implemented by objects that can return information about * the current call stack. Useful in AOP (as in AspectJ cflow concept) * but not AOP-specific. - * + * 通过实现该接口,能返回当前调用stack信息,AOP 中使用,但不是AOP-specific * @author Rod Johnson * @since 02.02.2004 */ @@ -29,13 +29,15 @@ public interface ControlFlow { /** * Detect whether we're under the given class, * according to the current stack trace. + * 检查我们是否在给定class下,根据当前stack trace * @param clazz the clazz to look for */ boolean under(Class clazz); - /** + /**检查我们是否在给定class和方法下,根据当前stack trace * Detect whether we're under the given class and method, * according to the current stack trace. + * * @param clazz the clazz to look for * @param methodName the name of the method to look for */ @@ -43,6 +45,7 @@ public interface ControlFlow { /** * Detect whether the current stack trace contains the given token. + * 检查我们是否在给定token下,根据当前stack trace * @param token the token to look for */ boolean underToken(String token); diff --git a/spring-core/src/main/java/org/springframework/core/ControlFlowFactory.java b/spring-core/src/main/java/org/springframework/core/ControlFlowFactory.java index 167de0f7e003..8bbdf959584b 100644 --- a/spring-core/src/main/java/org/springframework/core/ControlFlowFactory.java +++ b/spring-core/src/main/java/org/springframework/core/ControlFlowFactory.java @@ -27,7 +27,9 @@ * *

This implementation always uses the efficient Java 1.4 StackTraceElement * mechanism for analyzing control flows. - * + * + *

静态工程类隐藏自动选择ControlFlow的实现类 + * 通常用于jdk1.4分析control flows * @author Rod Johnson * @author Juergen Hoeller * @since 02.02.2004 @@ -36,6 +38,7 @@ public abstract class ControlFlowFactory { /** * Return an appropriate {@link ControlFlow} instance. + * 返回一个合适的ControlFlow实例 */ public static ControlFlow createControlFlow() { return new Jdk14ControlFlow(); @@ -47,7 +50,12 @@ public static ControlFlow createControlFlow() { * 5-10 times more expensive to evaluate than other pointcuts, as they require * analysis of the stack trace (through constructing a new throwable). * However, they are useful in some cases. + * *

This implementation uses the StackTraceElement class introduced in Java 1.4. + * + *

cflow-style 切面工具,比其他切面要耗性能5-10倍,因为需要分析stack trace + * 这个实现在jdk1.4引入StackTraceElement + * * @see java.lang.StackTraceElement */ static class Jdk14ControlFlow implements ControlFlow { @@ -60,6 +68,8 @@ public Jdk14ControlFlow() { /** * Searches for class name match in a StackTraceElement. + * + * 检查类名是否有匹配的在StackTraceElement中 */ @Override public boolean under(Class clazz) { @@ -76,6 +86,7 @@ public boolean under(Class clazz) { /** * Searches for class name match plus method name match * in a StackTraceElement. + * 检查类名和方法是否有匹配的在StackTraceElement中 */ @Override public boolean under(Class clazz, String methodName) { @@ -94,6 +105,8 @@ public boolean under(Class clazz, String methodName) { /** * Leave it up to the caller to decide what matches. * Caller must understand stack trace format, so there's less abstraction. + * 检查token是否有匹配的在StackTraceElement中 + * */ @Override public boolean underToken(String token) { diff --git a/spring-core/src/main/java/org/springframework/core/Conventions.java b/spring-core/src/main/java/org/springframework/core/Conventions.java index 867ff4fc5dab..3b2a95ee3cb5 100644 --- a/spring-core/src/main/java/org/springframework/core/Conventions.java +++ b/spring-core/src/main/java/org/springframework/core/Conventions.java @@ -33,7 +33,7 @@ /** * Provides methods to support various naming and other conventions used * throughout the framework. Mainly for internal use within the framework. - * + *

提供方法去支持不通的命名和其他用于该framewokr,主要用于内部使用 * @author Rob Harrop * @author Juergen Hoeller * @since 2.0 @@ -42,12 +42,15 @@ public abstract class Conventions { /** * Suffix added to names when using arrays. + * 后缀添加到名字,当使用list时 */ private static final String PLURAL_SUFFIX = "List"; /** * Set of interfaces that are supposed to be ignored * when searching for the 'primary' interface of a proxy. + * + * 应该被忽略的接口的集合,当查询代理的主要接口 */ private static final Set> IGNORED_INTERFACES; static { @@ -72,6 +75,7 @@ public abstract class Conventions { * For {@code Collection}s we attempt to 'peek ahead' in the * {@code Collection} to determine the component type and * return the pluralized version of that component type. + *

* @param value the value to generate a variable name for * @return the generated variable name */ @@ -104,6 +108,7 @@ else if (value instanceof Collection) { /** * Determine the conventional variable name for the supplied parameter, * taking the generic collection type (if any) into account. + *

决定conventional 变量名给根据提供的参数,将通用的集合类型给account * @param parameter the method or constructor parameter to generate a variable name for * @return the generated variable name */ @@ -135,6 +140,7 @@ else if (Collection.class.isAssignableFrom(parameter.getParameterType())) { /** * Determine the conventional variable name for the return type of the supplied method, * taking the generic collection type (if any) into account. + *

决定conventional 变量名给根据提供的方法返回类型,将通用的集合类型给account * @param method the method to generate a variable name for * @return the generated variable name */ @@ -147,6 +153,8 @@ public static String getVariableNameForReturnType(Method method) { * taking the generic collection type (if any) into account, falling back to the * given return value if the method declaration is not specific enough (i.e. in case of * the return type being declared as {@code Object} or as untyped collection). + * + *

决定conventional 变量名给根据提供的方法返回类型,将通用的集合类型给account * @param method the method to generate a variable name for * @param value the return value (may be {@code null} if not available) * @return the generated variable name @@ -160,6 +168,7 @@ public static String getVariableNameForReturnType(Method method, Object value) { * taking the generic collection type (if any) into account, falling back to the * given return value if the method declaration is not specific enough (i.e. in case of * the return type being declared as {@code Object} or as untyped collection). + *

决定conventional 变量名给根据提供的方法返回类型,将通用的集合类型给account * @param method the method to generate a variable name for * @param resolvedType the resolved return type of the method * @param value the return value (may be {@code null} if not available) @@ -211,6 +220,7 @@ else if (Collection.class.isAssignableFrom(resolvedType)) { * Convert {@code String}s in attribute name format (lowercase, hyphens separating words) * into property name format (camel-cased). For example, {@code transaction-manager} is * converted into {@code transactionManager}. + * 转换attribute名称到属性名称,去掉- */ public static String attributeNameToPropertyName(String attributeName) { Assert.notNull(attributeName, "'attributeName' must not be null"); @@ -240,6 +250,7 @@ else if (upperCaseNext) { * Return an attribute name qualified by the supplied enclosing {@link Class}. For example, * the attribute name '{@code foo}' qualified by {@link Class} '{@code com.myapp.SomeClass}' * would be '{@code com.myapp.SomeClass.foo}' + *

根据给定的类和属性名,拼接为一个字符串 */ public static String getQualifiedAttributeName(Class enclosingClass, String attributeName) { Assert.notNull(enclosingClass, "'enclosingClass' must not be null"); @@ -254,6 +265,8 @@ public static String getQualifiedAttributeName(Class enclosingClass, String a *

Will return the class of the given value, except when * encountering a JDK proxy, in which case it will determine * the 'primary' interface implemented by that proxy. + *

+ *

返回给定类的类名,当为代理类是,返回代理类的第一接口 * @param value the value to check * @return the class to use for naming a variable */ @@ -277,6 +290,7 @@ else if (valueClass.getName().lastIndexOf('$') != -1 && valueClass.getDeclaringC /** * Pluralize the given name. + * 多元化给定的name */ private static String pluralize(String name) { return name + PLURAL_SUFFIX; @@ -286,6 +300,7 @@ private static String pluralize(String name) { * Retrieves the {@code Class} of an element in the {@code Collection}. * The exact element for which the {@code Class} is retreived will depend * on the concrete {@code Collection} implementation. + *

检索给定类的元素在集合中,返回第一个元素,类的其他元素依赖于concrete的集合实现 */ private static E peekAhead(Collection collection) { Iterator it = collection.iterator(); diff --git a/spring-core/src/main/java/org/springframework/core/DecoratingClassLoader.java b/spring-core/src/main/java/org/springframework/core/DecoratingClassLoader.java index 4736ff109d3e..0254f2ea9913 100644 --- a/spring-core/src/main/java/org/springframework/core/DecoratingClassLoader.java +++ b/spring-core/src/main/java/org/springframework/core/DecoratingClassLoader.java @@ -26,7 +26,8 @@ * Base class for decorating ClassLoaders such as {@link OverridingClassLoader} * and {@link org.springframework.instrument.classloading.ShadowingClassLoader}, * providing common handling of excluded packages and classes. - * + *

装饰ClassLoaders的基础类,例如OverridingClassLoader和ShadowingClassLoader + * 提供通用的处理去排除给定包名和类名 * @author Juergen Hoeller * @author Rod Johnson * @since 2.5.2 @@ -52,6 +53,7 @@ public DecoratingClassLoader() { /** * Create a new DecoratingClassLoader using the given parent ClassLoader * for delegation. + * 根据给定的父ClassLoader创建一个新的DecoratingClassLoader */ public DecoratingClassLoader(ClassLoader parent) { super(parent); @@ -62,6 +64,8 @@ public DecoratingClassLoader(ClassLoader parent) { * Add a package name to exclude from decoration (e.g. overriding). *

Any class whose fully-qualified name starts with the name registered * here will be handled by the parent ClassLoader in the usual fashion. + * + *

添加一个包名到移除集合,任何包名在排除集合里面的类都会被父类处理 * @param packageName the package name to exclude */ public void excludePackage(String packageName) { @@ -73,6 +77,7 @@ public void excludePackage(String packageName) { * Add a class name to exclude from decoration (e.g. overriding). *

Any class name registered here will be handled by the parent * ClassLoader in the usual fashion. + *

添加一个类名到排除集合 * @param className the class name to exclude */ public void excludeClass(String className) { @@ -84,6 +89,7 @@ public void excludeClass(String className) { * Determine whether the specified class is excluded from decoration * by this class loader. *

The default implementation checks against excluded packages and classes. + *

判断给定的类是否在排除之外 * @param className the class name to check * @return whether the specified class is eligible * @see #excludePackage diff --git a/spring-core/src/main/java/org/springframework/core/DecoratingProxy.java b/spring-core/src/main/java/org/springframework/core/DecoratingProxy.java index b3ae9fceb0ad..6d0b861c9a07 100644 --- a/spring-core/src/main/java/org/springframework/core/DecoratingProxy.java +++ b/spring-core/src/main/java/org/springframework/core/DecoratingProxy.java @@ -40,6 +40,7 @@ public interface DecoratingProxy { * Return the (ultimate) decorated class behind this proxy. *

In case of an AOP proxy, this will be the ultimate target class, * not just the immediate target (in case of multiple nested proxies). + *

返回装饰类在代理下,AOP代理将会是最终的目标类, * @return the decorated class (never {@code null}) */ Class getDecoratedClass(); diff --git a/spring-core/src/main/java/org/springframework/core/DefaultParameterNameDiscoverer.java b/spring-core/src/main/java/org/springframework/core/DefaultParameterNameDiscoverer.java index fcd640714d28..d412d4d11127 100644 --- a/spring-core/src/main/java/org/springframework/core/DefaultParameterNameDiscoverer.java +++ b/spring-core/src/main/java/org/springframework/core/DefaultParameterNameDiscoverer.java @@ -23,7 +23,9 @@ * debug information in the class file. * *

Further discoverers may be added through {@link #addDiscoverer(ParameterNameDiscoverer)}. - * + *

默认实现ParameterNameDiscoverer策略接口,使用jdk8标准反射机制(如果可用), + * 如果不可用,就回落到LocalVariableTableParameterNameDiscoverer 为检查debug信息 + * * @author Juergen Hoeller * @since 4.0 * @see StandardReflectionParameterNameDiscoverer diff --git a/spring-core/src/main/java/org/springframework/core/ErrorCoded.java b/spring-core/src/main/java/org/springframework/core/ErrorCoded.java index 1425fe8492af..d65ef47dd130 100644 --- a/spring-core/src/main/java/org/springframework/core/ErrorCoded.java +++ b/spring-core/src/main/java/org/springframework/core/ErrorCoded.java @@ -22,7 +22,7 @@ * user-readable values, such as "object.failureDescription". * *

An error code can be resolved by a MessageSource, for example. - * + *

可以被类似exceptions等有错误代码的实现,错误代码为Stirng, * @author Rod Johnson * @see org.springframework.context.MessageSource */ @@ -31,6 +31,7 @@ public interface ErrorCoded { /** * Return the error code associated with this failure. * The GUI can render this any way it pleases, allowing for localization etc. + *

根据error code关联的错误 * @return a String error code associated with this failure, * or {@code null} if not error-coded */ diff --git a/spring-core/src/main/java/org/springframework/core/ExceptionDepthComparator.java b/spring-core/src/main/java/org/springframework/core/ExceptionDepthComparator.java index 6bcf98d05ba7..717876f0498d 100644 --- a/spring-core/src/main/java/org/springframework/core/ExceptionDepthComparator.java +++ b/spring-core/src/main/java/org/springframework/core/ExceptionDepthComparator.java @@ -26,7 +26,7 @@ /** * Comparator capable of sorting exceptions based on their depth from the thrown exception type. - * + *

根据异常抛出类型的深度,可排序异常的比较强 * @author Juergen Hoeller * @author Arjen Poutsma * @since 3.0.3 @@ -38,6 +38,7 @@ public class ExceptionDepthComparator implements Comparator 根据给定exception创建一个ExceptionDepthComparator * @param exception the target exception to compare to when sorting by depth */ public ExceptionDepthComparator(Throwable exception) { @@ -77,6 +78,9 @@ private int getDepth(Class declaredException, Class exceptionToMatch, int /** * Obtain the closest match from the given exception types for the given target exception. + * + *

获取最合适的exception类型根据给定的模板exception + * * @param exceptionTypes the collection of exception types * @param targetException the target exception to find a match for * @return the closest matching exception type from the given collection diff --git a/spring-core/src/main/java/org/springframework/core/GenericTypeResolver.java b/spring-core/src/main/java/org/springframework/core/GenericTypeResolver.java index c76c911094a7..64026cd84ce9 100644 --- a/spring-core/src/main/java/org/springframework/core/GenericTypeResolver.java +++ b/spring-core/src/main/java/org/springframework/core/GenericTypeResolver.java @@ -33,7 +33,7 @@ * *

Mainly intended for usage within the framework, resolving method * parameter types even when they are declared generically. - * + *

解析通讯类型保证类,主要用于框架 * @author Juergen Hoeller * @author Rob Harrop * @author Sam Brannen @@ -43,7 +43,7 @@ */ public abstract class GenericTypeResolver { - /** Cache from Class to TypeVariable Map */ + /** Cache from Class to TypeVariable Map 缓存类到类型变量 */ @SuppressWarnings("rawtypes") private static final Map, Map> typeVariableCache = new ConcurrentReferenceHashMap<>(); @@ -63,6 +63,7 @@ public static Type getTargetType(MethodParameter methodParameter) { /** * Determine the target type for the given generic parameter type. + *

根据给定的通用参数类型确定目标类型 * @param methodParameter the method parameter specification * @param implementationClass the class to resolve type variables against * @return the corresponding generic parameter or return type diff --git a/spring-core/src/main/java/org/springframework/core/InfrastructureProxy.java b/spring-core/src/main/java/org/springframework/core/InfrastructureProxy.java index 18f902864173..d406b069f4fd 100644 --- a/spring-core/src/main/java/org/springframework/core/InfrastructureProxy.java +++ b/spring-core/src/main/java/org/springframework/core/InfrastructureProxy.java @@ -29,6 +29,7 @@ * are supposed to implement this interface. Proxies that decorate the target * object with new behavior, such as AOP proxies, do not qualify here! * + *

透明的资源管理实现接口,需要考虑等同于底层资源, * @author Juergen Hoeller * @since 2.5.4 * @see org.springframework.transaction.support.TransactionSynchronizationManager @@ -37,6 +38,7 @@ public interface InfrastructureProxy { /** * Return the underlying resource (never {@code null}). + * 返回底层资源 */ Object getWrappedObject(); diff --git a/spring-core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java b/spring-core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java index 767be3046ef2..d9c29a7170f5 100644 --- a/spring-core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java +++ b/spring-core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java @@ -46,6 +46,9 @@ * caches the ASM discovered information for each introspected Class, in a thread-safe * manner. It is recommended to reuse ParameterNameDiscoverer instances as far as possible. * + *

ParameterNameDiscoverer 接口的实现类,用LocalVariableTable信息返回参数名称,如果类被编译,但没有debug信息,返回null + * 用ObjectWeb's ASM library 去分享类文件,没一个发现的实例缓存ASM发现的信息,在一个线程安全的下, + * 被推荐使用的ParameterNameDiscoverer实例 * @author Adrian Colyer * @author Costin Leau * @author Juergen Hoeller @@ -57,9 +60,15 @@ public class LocalVariableTableParameterNameDiscoverer implements ParameterNameD private static final Log logger = LogFactory.getLog(LocalVariableTableParameterNameDiscoverer.class); // marker object for classes that do not have any debug info + /** + * 标记类的对象,这些没有debug信息 + */ private static final Map NO_DEBUG_INFO_MAP = Collections.emptyMap(); // the cache uses a nested index (value is a map) to keep the top level cache relatively small in size + /** + * 缓存类别index,去缓存相关 + */ private final Map, Map> parameterNamesCache = new ConcurrentHashMap<>(32); @@ -96,12 +105,14 @@ public String[] getParameterNames(Constructor ctor) { /** * Inspects the target class. Exceptions will be logged and a maker map returned * to indicate the lack of debug information. + *

检查给定的类 */ private Map inspectClass(Class clazz) { InputStream is = clazz.getResourceAsStream(ClassUtils.getClassFileName(clazz)); if (is == null) { // We couldn't load the class file, which is not fatal as it // simply means this method of discovering parameter names won't work. + //无法加载类文件, if (logger.isDebugEnabled()) { logger.debug("Cannot find '.class' file for class [" + clazz + "] - unable to determine constructor/method parameter names"); @@ -160,6 +171,7 @@ public ParameterNameDiscoveringVisitor(Class clazz, Map mem @Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { // exclude synthetic + bridged && static class initialization + //排除synthetic+bridged和静态类初始化 if (!isSyntheticOrBridged(access) && !STATIC_CLASS_INIT.equals(name)) { return new LocalVariableTableVisitor(clazz, memberMap, name, desc, isStatic(access)); } diff --git a/spring-core/src/main/java/org/springframework/core/MethodClassKey.java b/spring-core/src/main/java/org/springframework/core/MethodClassKey.java index b837fc6486a1..c3cea00c97a4 100644 --- a/spring-core/src/main/java/org/springframework/core/MethodClassKey.java +++ b/spring-core/src/main/java/org/springframework/core/MethodClassKey.java @@ -24,7 +24,8 @@ * A common key class for a method against a specific target class, * including {@link #toString()} representation and {@link Comparable} * support (as suggested for custom {@code HashMap} keys as of Java 8). - * + *

一个通用的key类,对于一个方法对于一个特定的目标对象 + * * @author Juergen Hoeller * @since 4.3 */ @@ -37,6 +38,7 @@ public final class MethodClassKey implements Comparable { /** * Create a key object for the given method and target class. + *

创建一个key对象,根据给定的方向和对象 * @param method the method to wrap (must not be {@code null}) * @param targetClass the target class that the method will be invoked * on (may be {@code null} if identical to the declaring class) diff --git a/spring-core/src/main/java/org/springframework/core/MethodIntrospector.java b/spring-core/src/main/java/org/springframework/core/MethodIntrospector.java index 0f8e3965564b..de20f8c25f89 100644 --- a/spring-core/src/main/java/org/springframework/core/MethodIntrospector.java +++ b/spring-core/src/main/java/org/springframework/core/MethodIntrospector.java @@ -33,7 +33,7 @@ * as well as common scenarios encountered with interface and class-based proxies. * *

Typically, but not necessarily, used for finding annotated handler methods. - * + *

定义这个算法,用于查询元数据相关的方法,包括接口和父类通过也处理参数化的方法, * @author Juergen Hoeller * @author Rossen Stoyanchev * @since 4.2.3 @@ -44,6 +44,7 @@ public abstract class MethodIntrospector { * Select methods on the given target type based on the lookup of associated metadata. *

Callers define methods of interest through the {@link MetadataLookup} parameter, * allowing to collect the associated metadata into the result map. + *

选择基于查询的管理员数据的给定目标类型,调用者定义 * @param targetType the target type to search methods on * @param metadataLookup a {@link MetadataLookup} callback to inspect methods of interest, * returning non-null metadata to be associated with a given method if there is a match, diff --git a/spring-core/src/main/java/org/springframework/core/Ordered.java b/spring-core/src/main/java/org/springframework/core/Ordered.java index 2a328ea2ee01..e94ce0b8d480 100644 --- a/spring-core/src/main/java/org/springframework/core/Ordered.java +++ b/spring-core/src/main/java/org/springframework/core/Ordered.java @@ -31,7 +31,8 @@ * *

Consult the Javadoc for {@link OrderComparator} for details on the * sort semantics for non-ordered objects. - * + *

实现优先级接口 + * * @author Juergen Hoeller * @author Sam Brannen * @since 07.04.2003 @@ -62,6 +63,7 @@ public interface Ordered { * analogous to Servlet {@code load-on-startup} values). *

Same order values will result in arbitrary sort positions for the * affected objects. + *

获取order值 * @return the order value * @see #HIGHEST_PRECEDENCE * @see #LOWEST_PRECEDENCE diff --git a/spring-core/src/main/java/org/springframework/core/OverridingClassLoader.java b/spring-core/src/main/java/org/springframework/core/OverridingClassLoader.java index 5a45cde1f2ef..199315f36e2f 100644 --- a/spring-core/src/main/java/org/springframework/core/OverridingClassLoader.java +++ b/spring-core/src/main/java/org/springframework/core/OverridingClassLoader.java @@ -28,14 +28,14 @@ * where selected application classes are temporarily loaded in the overriding * {@code ClassLoader} for introspection purposes before eventually loading an * instrumented version of the class in the given parent {@code ClassLoader}. - * + *

ClassLoader 不总是委托给父类loader,他可以, * @author Rod Johnson * @author Juergen Hoeller * @since 2.0.1 */ public class OverridingClassLoader extends DecoratingClassLoader { - /** Packages that are excluded by default */ + /** Packages that are excluded by default 默契移除包*/ public static final String[] DEFAULT_EXCLUDED_PACKAGES = new String[] {"java.", "javax.", "sun.", "oracle.", "javassist.", "org.aspectj.", "net.sf.cglib."}; @@ -51,6 +51,7 @@ public class OverridingClassLoader extends DecoratingClassLoader { /** * Create a new OverridingClassLoader for the given ClassLoader. + * 创建一个新的OverridingClassLoader 根据给定ClassLoader * @param parent the ClassLoader to build an overriding ClassLoader for */ public OverridingClassLoader(ClassLoader parent) { @@ -59,6 +60,7 @@ public OverridingClassLoader(ClassLoader parent) { /** * Create a new OverridingClassLoader for the given ClassLoader. + * 创建一个新的OverridingClassLoader 根据给定ClassLoader * @param parent the ClassLoader to build an overriding ClassLoader for * @param overrideDelegate the ClassLoader to delegate to for overriding * @since 4.3 @@ -97,6 +99,7 @@ protected Class loadClass(String name, boolean resolve) throws ClassNotFoundE /** * Determine whether the specified class is eligible for overriding * by this class loader. + * 确定该类是否应该由该class loader处理 * @param className the class name to check * @return whether the specified class is eligible * @see #isExcluded @@ -109,6 +112,7 @@ protected boolean isEligibleForOverriding(String className) { * Load the specified class for overriding purposes in this ClassLoader. *

The default implementation delegates to {@link #findLoadedClass}, * {@link #loadBytesForClass} and {@link #defineClass}. + * * @param name the name of the class * @return the Class object, or {@code null} if no class defined for that name * @throws ClassNotFoundException if the class for the given name couldn't be loaded diff --git a/spring-core/src/main/java/org/springframework/core/ParameterNameDiscoverer.java b/spring-core/src/main/java/org/springframework/core/ParameterNameDiscoverer.java index 01356c2967b9..9af1cb94a122 100644 --- a/spring-core/src/main/java/org/springframework/core/ParameterNameDiscoverer.java +++ b/spring-core/src/main/java/org/springframework/core/ParameterNameDiscoverer.java @@ -36,6 +36,7 @@ public interface ParameterNameDiscoverer { /** * Return parameter names for this method, * or {@code null} if they cannot be determined. + *

返回方法的参数名,如果无法确定返回null * @param method method to find parameter names for * @return an array of parameter names if the names can be resolved, * or {@code null} if they cannot @@ -45,6 +46,7 @@ public interface ParameterNameDiscoverer { /** * Return parameter names for this constructor, * or {@code null} if they cannot be determined. + *

返回该类构造返回的参数名,不确定返回null * @param ctor constructor to find parameter names for * @return an array of parameter names if the names can be resolved, * or {@code null} if they cannot diff --git a/spring-core/src/main/java/org/springframework/core/PrioritizedParameterNameDiscoverer.java b/spring-core/src/main/java/org/springframework/core/PrioritizedParameterNameDiscoverer.java index 535118be7d6b..57969c9e36c2 100644 --- a/spring-core/src/main/java/org/springframework/core/PrioritizedParameterNameDiscoverer.java +++ b/spring-core/src/main/java/org/springframework/core/PrioritizedParameterNameDiscoverer.java @@ -28,7 +28,7 @@ * *

The default behavior is always to return {@code null} * if no discoverer matches. - * + *

一系列ParameterNameDiscoverer实现的list集合,顺序进行检测 * @author Rod Johnson * @author Juergen Hoeller * @since 2.0 diff --git a/spring-core/src/main/java/org/springframework/core/ReactiveAdapter.java b/spring-core/src/main/java/org/springframework/core/ReactiveAdapter.java index a829562f2d2a..554280eebc4d 100644 --- a/spring-core/src/main/java/org/springframework/core/ReactiveAdapter.java +++ b/spring-core/src/main/java/org/springframework/core/ReactiveAdapter.java @@ -28,7 +28,9 @@ * *

Use the {@link ReactiveAdapterRegistry} to obtain an adapter for a * supported adaptee type or to register additional adapters. - * + * + *

{@link Flux} and {@link Mono} 适配器之间的沟通类 + * 使用ReactiveAdapterRegistry 去获取一个支持视频类型的适配器,或者注册额外的适配器 * @author Rossen Stoyanchev * @since 5.0 */ @@ -36,11 +38,14 @@ public interface ReactiveAdapter { /** * Return a descriptor with further information about the adaptee. + * 返回adaptee的更多信息的描述符 */ Descriptor getDescriptor(); /** * Adapt the given Object to a {@link Mono} + * + * 适配给定对象给{@link Mono} * @param source the source object to adapt * @return the resulting {@link Mono} possibly empty */ @@ -48,6 +53,7 @@ public interface ReactiveAdapter { /** * Adapt the given Object to a {@link Flux}. + * 适配给定对象给{@link Flux} * @param source the source object to adapt * @return the resulting {@link Flux} possibly empty */ @@ -55,6 +61,7 @@ public interface ReactiveAdapter { /** * Adapt the given Object to a Publisher. + * 适配给定对象给Publisher * @param source the source object to adapt * @return the resulting {@link Mono} or {@link Flux} possibly empty */ @@ -62,6 +69,7 @@ public interface ReactiveAdapter { /** * Adapt the given Publisher to the target adaptee. + * 适配给定Publisher到目标对象adaptee * @param publisher the publisher to adapt * @return the resulting adaptee */ @@ -70,6 +78,7 @@ public interface ReactiveAdapter { /** * A descriptor with information about the adaptee stream semantics. + * adaptee对象的描述符 */ class Descriptor { @@ -90,6 +99,9 @@ public Descriptor(boolean isMultiValue, boolean canBeEmpty, boolean isNoValue) { * and is therefore a good fit to adapt to {@link Flux}. A {@code false} * return value implies the adaptee will produce 1 value at most and is * therefore a good fit for {@link Mono}. + * + * 如果适配器能生成0..N个值则适合适配给 {@link Flux}返回true + * 如果适配器能生成1个值最多,那么适合适配给{@link Mono}返回false */ public boolean isMultiValue() { return this.isMultiValue; @@ -97,6 +109,7 @@ public boolean isMultiValue() { /** * Return {@code true} if the adaptee can complete without values. + * 如果适配器可以不需要值完成操作,返回true */ public boolean supportsEmpty() { return this.supportsEmpty; @@ -105,6 +118,8 @@ public boolean supportsEmpty() { /** * Return {@code true} if the adaptee implies no values will be produced, * i.e. providing only completion or error signal. + * + * 如果适配器没有值被生成,返回true, */ public boolean isNoValue() { return this.isNoValue; diff --git a/spring-core/src/main/java/org/springframework/core/ReactiveAdapterRegistry.java b/spring-core/src/main/java/org/springframework/core/ReactiveAdapterRegistry.java index c6287f42435f..8f2f374c8f38 100644 --- a/spring-core/src/main/java/org/springframework/core/ReactiveAdapterRegistry.java +++ b/spring-core/src/main/java/org/springframework/core/ReactiveAdapterRegistry.java @@ -39,7 +39,7 @@ *

By default there are adapters for {@link CompletableFuture}, RxJava 1, and * also for a any Reactive Streams {@link Publisher}. Additional adapters can be * registered via {@link #registerFluxAdapter} and {@link #registerMonoAdapter}. - * + *

{@link Flux} and {@link Mono} 适配器的注册器 * @author Rossen Stoyanchev * @since 5.0 */ @@ -53,6 +53,8 @@ public class ReactiveAdapterRegistry { /** * Create a registry and auto-register default adapters. + * + * 创建一个注册器,自动注册默认的适配器 */ public ReactiveAdapterRegistry() { // Flux and Mono ahead of Publisher... diff --git a/spring-core/src/main/java/org/springframework/core/ResolvableType.java b/spring-core/src/main/java/org/springframework/core/ResolvableType.java index 2302b88d2399..e11dee89126b 100644 --- a/spring-core/src/main/java/org/springframework/core/ResolvableType.java +++ b/spring-core/src/main/java/org/springframework/core/ResolvableType.java @@ -95,26 +95,31 @@ public class ResolvableType implements Serializable { /** * The underlying Java type being managed (only ever {@code null} for {@link #NONE}). + * 管理底层java类型 */ private final Type type; /** * Optional provider for the type. + * 可选的类型提供器 */ private final TypeProvider typeProvider; /** * The {@code VariableResolver} to use or {@code null} if no resolver is available. + * 变量解析器,null如果没有解析器可用 */ private final VariableResolver variableResolver; /** * The component type for an array or {@code null} if the type should be deduced. + * 一个数组类型 */ private final ResolvableType componentType; /** * Copy of the resolved value. + * resolved的值的copy */ private final Class resolved; @@ -130,6 +135,7 @@ public class ResolvableType implements Serializable { /** * Private constructor used to create a new {@link ResolvableType} for cache key purposes, * with no upfront resolution. + * 为缓存key创建一个ResolvableType对象, */ private ResolvableType(Type type, TypeProvider typeProvider, VariableResolver variableResolver) { this.type = type; @@ -187,6 +193,7 @@ private ResolvableType(Class sourceClass) { /** * Return the underling Java {@link Type} being managed. With the exception of * the {@link #NONE} constant, this method will never return {@code null}. + * 返回底层被管理的java类型 */ public Type getType() { return SerializableTypeWrapper.unwrap(this.type); @@ -195,6 +202,7 @@ public Type getType() { /** * Return the underlying Java {@link Class} being managed, if available; * otherwise {@code null}. + * 返回底层被管理的java对象 */ public Class getRawClass() { if (this.type == this.resolved) { @@ -221,6 +229,7 @@ public Object getSource() { /** * Determine whether the given object is an instance of this {@code ResolvableType}. + * 判断给定对象是否是当前ResolvableType的一个实例 * @param obj the object to check * @since 4.2 * @see #isAssignableFrom(Class) @@ -232,6 +241,7 @@ public boolean isInstance(Object obj) { /** * Determine whether this {@code ResolvableType} is assignable from the * specified other type. + * 判断是否ResolvableType是从其他特定类型指定的 * @param other the type to be checked against (as a {@code Class}) * @since 4.2 * @see #isAssignableFrom(ResolvableType) @@ -258,12 +268,12 @@ public boolean isAssignableFrom(ResolvableType other) { private boolean isAssignableFrom(ResolvableType other, Map matchedBefore) { Assert.notNull(other, "ResolvableType must not be null"); - // If we cannot resolve types, we are not assignable + // If we cannot resolve types, we are not assignable 如果不能解析类型,是不被指定的 if (this == NONE || other == NONE) { return false; } - // Deal with array by delegating to the component type + // Deal with array by delegating to the component type 处理数组 if (isArray()) { return (other.isArray() && getComponentType().isAssignableFrom(other.getComponentType())); } @@ -272,7 +282,7 @@ private boolean isAssignableFrom(ResolvableType other, Map matchedBe return true; } - // Deal with wildcard bounds + // Deal with wildcard bounds 处理统配符 WildcardBounds ourBounds = WildcardBounds.get(this); WildcardBounds typeBounds = WildcardBounds.get(other); diff --git a/spring-core/src/main/java/org/springframework/core/ResolvableTypeProvider.java b/spring-core/src/main/java/org/springframework/core/ResolvableTypeProvider.java index 1f361fbc5d7d..1b31956fc008 100644 --- a/spring-core/src/main/java/org/springframework/core/ResolvableTypeProvider.java +++ b/spring-core/src/main/java/org/springframework/core/ResolvableTypeProvider.java @@ -26,6 +26,8 @@ * when the generic type signature of the class changes in sub-classes. It is always * possible to return {@code null} to fallback on a default behaviour. * + *

提供实际的ResolvableType ,可以用在java不支持的签名时,提供一个通用的签名, + * * @author Stephane Nicoll * @since 4.2 */ @@ -34,6 +36,8 @@ public interface ResolvableTypeProvider { /** * Return the {@link ResolvableType} describing this instance * (or {@code null} if some sort of default should be applied instead). + * + * 返回ResolvableType描述的实例,null如果一下默认排序能被处理 */ ResolvableType getResolvableType(); diff --git a/spring-core/src/main/java/org/springframework/core/SimpleAliasRegistry.java b/spring-core/src/main/java/org/springframework/core/SimpleAliasRegistry.java index b1ff3b7e0099..1884831f4c32 100644 --- a/spring-core/src/main/java/org/springframework/core/SimpleAliasRegistry.java +++ b/spring-core/src/main/java/org/springframework/core/SimpleAliasRegistry.java @@ -37,7 +37,7 @@ */ public class SimpleAliasRegistry implements AliasRegistry { - /** Map from alias to canonical name */ + /** Map from alias to canonical name 别名对应的name */ private final Map aliasMap = new ConcurrentHashMap<>(16); @@ -133,6 +133,8 @@ private void retrieveAliases(String name, List result) { * factory, applying the given StringValueResolver to them. *

The value resolver may for example resolve placeholders * in target bean names and even in alias names. + *

解析所有别名目标name和注册在该类的别名,提供给定StringValueResolver + * 该值解析器可能解析占位符在目标bean和别名上 * @param valueResolver the StringValueResolver to apply */ public void resolveAliases(StringValueResolver valueResolver) { @@ -150,7 +152,7 @@ else if (!resolvedAlias.equals(alias)) { String existingName = this.aliasMap.get(resolvedAlias); if (existingName != null) { if (existingName.equals(resolvedName)) { - // Pointing to existing alias - just remove placeholder + // Pointing to existing alias - just remove placeholder 指向存在的别名,移除占位符 this.aliasMap.remove(alias); break; } @@ -174,6 +176,9 @@ else if (!registeredName.equals(resolvedName)) { * Check whether the given name points back to the given alias as an alias * in the other direction already, catching a circular reference upfront * and throwing a corresponding IllegalStateException. + * + * 检测给定名称是否为已经存在的别名 + * * @param name the candidate name * @param alias the candidate alias * @see #registerAlias @@ -189,6 +194,7 @@ protected void checkForAliasCircle(String name, String alias) { /** * Determine the raw name, resolving aliases to canonical names. + * 获取别名的name * @param name the user-specified name * @return the transformed name */ diff --git a/spring-core/src/main/java/org/springframework/core/SmartClassLoader.java b/spring-core/src/main/java/org/springframework/core/SmartClassLoader.java index a0f72d0ba42f..b4f6626051c1 100644 --- a/spring-core/src/main/java/org/springframework/core/SmartClassLoader.java +++ b/spring-core/src/main/java/org/springframework/core/SmartClassLoader.java @@ -24,7 +24,8 @@ *

If a ClassLoader does not implement this interface, * then all of the classes obtained from it should be considered * as not reloadable (i.e. cacheable). - * + *

ClassLoader重新加载通知接口,例如Spring CGLIB 代理工厂标记一个缓存的决策 + * 如果一个ClassLoader不实现该接口,那么所有这些类应该考虑不能重新加载 * @author Juergen Hoeller * @since 2.5.1 */ @@ -34,6 +35,9 @@ public interface SmartClassLoader { * Determine whether the given class is reloadable (in this ClassLoader). *

Typically used to check whether the result may be cached (for this * ClassLoader) or whether it should be reobtained every time. + *

判断给定类是否可用重新加载,在这个ClassLoader中 + * 通常用于检测结果是否可用被缓存, + * * @param clazz the class to check (usually loaded from this ClassLoader) * @return whether the class should be expected to appear in a reloaded * version (with a different {@code Class} object) later on diff --git a/spring-core/src/main/java/org/springframework/core/SpringProperties.java b/spring-core/src/main/java/org/springframework/core/SpringProperties.java index f5c3499428a0..186e89ed4b34 100644 --- a/spring-core/src/main/java/org/springframework/core/SpringProperties.java +++ b/spring-core/src/main/java/org/springframework/core/SpringProperties.java @@ -36,6 +36,12 @@ * "spring.getenv.ignore" and "spring.beaninfo.ignore", in particular for scenarios * where JVM system properties are locked on the target platform (e.g. WebSphere). * See {@link #setFlag} for a convenient way to locally set such flags to "true". + * + *

本地spring属性的静态持有者,比如在spring lib里面定义的属性 + * 读取一个spring属性文件从spring lib的根目录,同样可用通过程序设置属性通过setProperty + * 当检测一个属性时,本地的会首先检查,返回时JVM系统级别的属性,通过System.getProperty + *

有另外一种方式设置spring相关的系统属性,例如 "spring.getenv.ignore" and "spring.beaninfo.ignore" + * 特别当JVM系统属性锁定在目标平台,通过setFlag方法可以方便的处理该问题 * * @author Juergen Hoeller * @since 3.2.7 @@ -80,6 +86,7 @@ public abstract class SpringProperties { /** * Programmatically set a local property, overriding an entry in the * {@code spring.properties} file (if any). + * 通过程序设置本地属性, * @param key the property key * @param value the associated property value, or {@code null} to reset it */ @@ -95,6 +102,7 @@ public static void setProperty(String key, String value) { /** * Retrieve the property value for the given key, checking local Spring * properties first and falling back to JVM-level system properties. + * 获取给定key的属性值,首先检查本地spring属性,然后是JVM级别的系统属性 * @param key the property key * @return the associated property value, or {@code null} if none found */ @@ -116,6 +124,7 @@ public static String getProperty(String key) { /** * Programmatically set a local flag to "true", overriding an * entry in the {@code spring.properties} file (if any). + * 程序设置本地标记为true,进入spring属性文件 * @param key the property key */ public static void setFlag(String key) { @@ -124,6 +133,8 @@ public static void setFlag(String key) { /** * Retrieve the flag for the given property key. + * + * 获取给定属性key的标记 * @param key the property key * @return {@code true} if the property is set to "true", * {@code} false otherwise diff --git a/spring-core/src/main/java/org/springframework/core/SpringVersion.java b/spring-core/src/main/java/org/springframework/core/SpringVersion.java index 38426f1be841..c3bd11fcada1 100644 --- a/spring-core/src/main/java/org/springframework/core/SpringVersion.java +++ b/spring-core/src/main/java/org/springframework/core/SpringVersion.java @@ -25,6 +25,8 @@ * in all environments. Consider using a reflection-based check instead: * For example, checking for the presence of a specific Spring 2.0 * method that you intend to call. + * + *

这个类暴露sping的版本号,获取Implementation-Version属性通过jar文件 * * @author Juergen Hoeller * @since 1.1 @@ -34,6 +36,7 @@ public class SpringVersion { /** * Return the full version string of the present Spring codebase, * or {@code null} if it cannot be determined. + * 返回spring的版本号 * @see Package#getImplementationVersion() */ public static String getVersion() { diff --git a/spring-core/src/main/java/org/springframework/core/StandardReflectionParameterNameDiscoverer.java b/spring-core/src/main/java/org/springframework/core/StandardReflectionParameterNameDiscoverer.java index f263681aed4d..92a423d12be9 100644 --- a/spring-core/src/main/java/org/springframework/core/StandardReflectionParameterNameDiscoverer.java +++ b/spring-core/src/main/java/org/springframework/core/StandardReflectionParameterNameDiscoverer.java @@ -23,7 +23,8 @@ /** * {@link ParameterNameDiscoverer} implementation which uses JDK 8's reflection facilities * for introspecting parameter names (based on the "-parameters" compiler flag). - * + * + *

jdk8标准反射工具ParameterNameDiscoverer实现类,为反射的参数类 * @author Juergen Hoeller * @since 4.0 * @see java.lang.reflect.Parameter#getName() diff --git a/spring-core/src/main/java/org/springframework/core/annotation/AbstractAliasAwareAnnotationAttributeExtractor.java b/spring-core/src/main/java/org/springframework/core/annotation/AbstractAliasAwareAnnotationAttributeExtractor.java index 32b8725c2d65..731dc2b5fb11 100644 --- a/spring-core/src/main/java/org/springframework/core/annotation/AbstractAliasAwareAnnotationAttributeExtractor.java +++ b/spring-core/src/main/java/org/springframework/core/annotation/AbstractAliasAwareAnnotationAttributeExtractor.java @@ -29,6 +29,7 @@ * that transparently enforce attribute alias semantics for annotation * attributes that are annotated with {@link AliasFor @AliasFor}. * + *

AnnotationAttributeExtractor虚拟实现类,被AliasFor标记的元素 * @author Sam Brannen * @since 4.2 * @param the type of source supported by this extractor diff --git a/spring-core/src/main/java/org/springframework/core/annotation/MapAnnotationAttributeExtractor.java b/spring-core/src/main/java/org/springframework/core/annotation/MapAnnotationAttributeExtractor.java index 24bdb15dc1dd..e8cfd4dd8f2c 100644 --- a/spring-core/src/main/java/org/springframework/core/annotation/MapAnnotationAttributeExtractor.java +++ b/spring-core/src/main/java/org/springframework/core/annotation/MapAnnotationAttributeExtractor.java @@ -30,7 +30,9 @@ /** * Implementation of the {@link AnnotationAttributeExtractor} strategy that * is backed by a {@link Map}. - * + * + *

AnnotationAttributeExtractor策略实现类, + * * @author Sam Brannen * @since 4.2 * @see Annotation @@ -46,6 +48,7 @@ class MapAnnotationAttributeExtractor extends AbstractAliasAwareAnnotationAttrib *

The supplied map must contain a key-value pair for every attribute * defined in the supplied {@code annotationType} that is not aliased or * does not have a default value. + *

提供的map必须包括所有提供的annotationType属性提供的属性, * @param attributes the map of annotation attributes; never {@code null} * @param annotationType the type of annotation to synthesize; never {@code null} * @param annotatedElement the element that is annotated with the annotation @@ -82,6 +85,7 @@ protected Object getRawAttributeValue(String attributeName) { * either to the value of its alias (if an alias exists) or to the * value of the attribute's default value (if defined), and otherwise * an {@link IllegalArgumentException} will be thrown. + * */ @SuppressWarnings("unchecked") private static Map enrichAndValidateAttributes( @@ -94,7 +98,7 @@ private static Map enrichAndValidateAttributes( String attributeName = attributeMethod.getName(); Object attributeValue = attributes.get(attributeName); - // if attribute not present, check aliases + // if attribute not present, check aliases 如果属性不存在,检查别名 if (attributeValue == null) { List aliasNames = attributeAliasMap.get(attributeName); if (aliasNames != null) { @@ -109,7 +113,7 @@ private static Map enrichAndValidateAttributes( } } - // if aliases not present, check default + // if aliases not present, check default 如果别名不存在,检查默认 if (attributeValue == null) { Object defaultValue = AnnotationUtils.getDefaultValue(annotationType, attributeName); if (defaultValue != null) { @@ -123,7 +127,7 @@ private static Map enrichAndValidateAttributes( "Attributes map %s returned null for required attribute '%s' defined by annotation type [%s].", attributes, attributeName, annotationType.getName())); - // finally, ensure correct type + // finally, ensure correct type 最后确保类型正确 Class requiredReturnType = attributeMethod.getReturnType(); Class actualReturnType = attributeValue.getClass(); diff --git a/spring-core/src/main/java/org/springframework/core/annotation/OrderUtils.java b/spring-core/src/main/java/org/springframework/core/annotation/OrderUtils.java index 350a7bdf6ff9..298a66d71e0e 100644 --- a/spring-core/src/main/java/org/springframework/core/annotation/OrderUtils.java +++ b/spring-core/src/main/java/org/springframework/core/annotation/OrderUtils.java @@ -24,6 +24,7 @@ * General utility for determining the order of an object based on its type declaration. * Handles Spring's {@link Order} annotation as well as {@link javax.annotation.Priority}. * + *

通用工具类,判断一个对象的顺序基于他类型定义 ,通用可以处理{@link javax.annotation.Priority} * @author Stephane Nicoll * @author Juergen Hoeller * @since 4.1 @@ -49,6 +50,7 @@ public abstract class OrderUtils { /** * Return the order on the specified {@code type}. *

Take care of {@link Order @Order} and {@code @javax.annotation.Priority}. + *

返回给定类型的order. * @param type the type to handle * @return the order value, or {@code null} if none can be found */ @@ -60,6 +62,7 @@ public static Integer getOrder(Class type) { * Return the order on the specified {@code type}, or the specified * default value if none can be found. *

Take care of {@link Order @Order} and {@code @javax.annotation.Priority}. + *

返回给定类型的order. * @param type the type to handle * @return the priority value, or the specified default order if none can be found */ @@ -78,6 +81,7 @@ public static Integer getOrder(Class type, Integer defaultOrder) { /** * Return the value of the {@code javax.annotation.Priority} annotation * declared on the specified type, or {@code null} if none. + *

返回Priority annotation定义的值 * @param type the type to handle * @return the priority value if the annotation is declared, or {@code null} if none */ diff --git a/spring-core/src/main/java/org/springframework/core/annotation/SynthesizedAnnotation.java b/spring-core/src/main/java/org/springframework/core/annotation/SynthesizedAnnotation.java index 028c06625e1e..9a7657064fd8 100644 --- a/spring-core/src/main/java/org/springframework/core/annotation/SynthesizedAnnotation.java +++ b/spring-core/src/main/java/org/springframework/core/annotation/SynthesizedAnnotation.java @@ -20,7 +20,7 @@ * Marker interface implemented by synthesized annotation proxies. * *

Used to detect whether an annotation has already been synthesized. - * + *

合成annotation代理实现接口,判断annotation已经为合成了 * @author Sam Brannen * @since 4.2 */ diff --git a/spring-core/src/main/java/org/springframework/core/annotation/SynthesizingMethodParameter.java b/spring-core/src/main/java/org/springframework/core/annotation/SynthesizingMethodParameter.java index 9f76491246ea..f4ba6a37235f 100644 --- a/spring-core/src/main/java/org/springframework/core/annotation/SynthesizingMethodParameter.java +++ b/spring-core/src/main/java/org/springframework/core/annotation/SynthesizingMethodParameter.java @@ -27,7 +27,7 @@ /** * A {@link MethodParameter} variant which synthesizes annotations that * declare attribute aliases via {@link AliasFor @AliasFor}. - * + *

MethodParameter * @author Juergen Hoeller * @author Sam Brannen * @since 4.2 diff --git a/spring-core/src/main/java/org/springframework/core/codec/AbstractDecoder.java b/spring-core/src/main/java/org/springframework/core/codec/AbstractDecoder.java index c2a6f8bf2606..a3a4724c21af 100644 --- a/spring-core/src/main/java/org/springframework/core/codec/AbstractDecoder.java +++ b/spring-core/src/main/java/org/springframework/core/codec/AbstractDecoder.java @@ -28,7 +28,7 @@ /** * Abstract base class for {@link Decoder} implementations. - * + *

Decoder接口的虚拟实现类 * @author Sebastien Deleuze * @author Arjen Poutsma * @since 5.0 diff --git a/spring-core/src/main/java/org/springframework/core/codec/AbstractEncoder.java b/spring-core/src/main/java/org/springframework/core/codec/AbstractEncoder.java index 31274cec02b1..e30a50af9774 100644 --- a/spring-core/src/main/java/org/springframework/core/codec/AbstractEncoder.java +++ b/spring-core/src/main/java/org/springframework/core/codec/AbstractEncoder.java @@ -24,7 +24,7 @@ /** * Abstract base class for {@link Decoder} implementations. - * + *

Decoder实现类 * @author Sebastien Deleuze * @author Arjen Poutsma * @since 5.0 diff --git a/spring-core/src/main/java/org/springframework/core/codec/AbstractSingleValueEncoder.java b/spring-core/src/main/java/org/springframework/core/codec/AbstractSingleValueEncoder.java index d3b6669528ee..3ee5f4c00317 100644 --- a/spring-core/src/main/java/org/springframework/core/codec/AbstractSingleValueEncoder.java +++ b/spring-core/src/main/java/org/springframework/core/codec/AbstractSingleValueEncoder.java @@ -27,7 +27,7 @@ /** * Abstract base class for {@link org.springframework.core.codec.Encoder} * classes that can only deal with a single value. - * + *

Encoder类的子类,只能处理一个单独的值 * @author Arjen Poutsma * @since 5.0 */ diff --git a/spring-core/src/main/java/org/springframework/core/codec/ByteBufferDecoder.java b/spring-core/src/main/java/org/springframework/core/codec/ByteBufferDecoder.java index 7c52eaf7040c..23297eebd15c 100644 --- a/spring-core/src/main/java/org/springframework/core/codec/ByteBufferDecoder.java +++ b/spring-core/src/main/java/org/springframework/core/codec/ByteBufferDecoder.java @@ -29,7 +29,7 @@ /** * Decoder for {@link ByteBuffer}s. - * + *

ByteBuffer的解码器 * @author Sebastien Deleuze * @author Arjen Poutsma * @since 5.0 diff --git a/spring-core/src/main/java/org/springframework/core/codec/ByteBufferEncoder.java b/spring-core/src/main/java/org/springframework/core/codec/ByteBufferEncoder.java index 33a3d36d0a14..fe4c5d7e949a 100644 --- a/spring-core/src/main/java/org/springframework/core/codec/ByteBufferEncoder.java +++ b/spring-core/src/main/java/org/springframework/core/codec/ByteBufferEncoder.java @@ -29,7 +29,7 @@ /** * Encoder for {@link ByteBuffer}s. - * + *

ByteBuffer的编码器 * @author Sebastien Deleuze * @since 5.0 */ diff --git a/spring-core/src/main/java/org/springframework/core/codec/CharSequenceEncoder.java b/spring-core/src/main/java/org/springframework/core/codec/CharSequenceEncoder.java index b8c52d6a5a77..ab3969534fcc 100644 --- a/spring-core/src/main/java/org/springframework/core/codec/CharSequenceEncoder.java +++ b/spring-core/src/main/java/org/springframework/core/codec/CharSequenceEncoder.java @@ -31,7 +31,7 @@ /** * Encode from a {@code CharSequence} stream to a bytes stream. - * + * 加密一个CharSequence流到字节流 * @author Sebastien Deleuze * @author Arjen Poutsma * @since 5.0 diff --git a/spring-core/src/main/java/org/springframework/core/codec/ResourceDecoder.java b/spring-core/src/main/java/org/springframework/core/codec/ResourceDecoder.java index 533f5b5769af..68d4a2f5a6d1 100644 --- a/spring-core/src/main/java/org/springframework/core/codec/ResourceDecoder.java +++ b/spring-core/src/main/java/org/springframework/core/codec/ResourceDecoder.java @@ -33,7 +33,7 @@ /** * Decoder for {@link Resource}s. - * + *

Resource的解码器 * @author Arjen Poutsma * @since 5.0 */ diff --git a/spring-core/src/main/java/org/springframework/core/codec/ResourceEncoder.java b/spring-core/src/main/java/org/springframework/core/codec/ResourceEncoder.java index 0942b5d307a0..eca72a23952d 100644 --- a/spring-core/src/main/java/org/springframework/core/codec/ResourceEncoder.java +++ b/spring-core/src/main/java/org/springframework/core/codec/ResourceEncoder.java @@ -33,7 +33,7 @@ /** * Encoder for {@link Resource}s. - * + *

Resource的加密器 * @author Arjen Poutsma * @since 5.0 */ diff --git a/spring-core/src/main/java/org/springframework/core/codec/StringDecoder.java b/spring-core/src/main/java/org/springframework/core/codec/StringDecoder.java index 2e12c23a1609..95e29230f2dc 100644 --- a/spring-core/src/main/java/org/springframework/core/codec/StringDecoder.java +++ b/spring-core/src/main/java/org/springframework/core/codec/StringDecoder.java @@ -39,7 +39,7 @@ *

By default, this decoder will split the received {@link DataBuffer}s * along newline characters ({@code \r\n}), but this can be changed by * passing {@code false} as a constructor argument. - * + *

加密一个字节流到string流 * @author Sebastien Deleuze * @author Brian Clozel * @author Arjen Poutsma diff --git a/spring-core/src/main/java/org/springframework/core/convert/converter/ConditionalConverter.java b/spring-core/src/main/java/org/springframework/core/convert/converter/ConditionalConverter.java index 964139e0a2e6..8020192b9945 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/converter/ConditionalConverter.java +++ b/spring-core/src/main/java/org/springframework/core/convert/converter/ConditionalConverter.java @@ -31,7 +31,7 @@ *

As another example, when converting from a String field to an {@code Account} field, * an implementation might return {@code true} if the target Account class defines a * {@code public static findAccount(String)} method. - * + *

Converter有条件的转换器 * @author Phillip Webb * @author Keith Donald * @since 3.2 diff --git a/spring-core/src/main/java/org/springframework/core/convert/converter/Converter.java b/spring-core/src/main/java/org/springframework/core/convert/converter/Converter.java index 0d3c5dc14fab..d8fe8197bfc3 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/converter/Converter.java +++ b/spring-core/src/main/java/org/springframework/core/convert/converter/Converter.java @@ -33,6 +33,7 @@ public interface Converter { /** * Convert the source object of type {@code S} to target type {@code T}. + *

转换源对象到目标对象 * @param source the source object to convert, which must be an instance of {@code S} (never {@code null}) * @return the converted object, which must be an instance of {@code T} (potentially {@code null}) * @throws IllegalArgumentException if the source cannot be converted to the desired target type diff --git a/spring-core/src/main/java/org/springframework/core/convert/converter/ConvertingComparator.java b/spring-core/src/main/java/org/springframework/core/convert/converter/ConvertingComparator.java index 19e128c88485..6023da806b33 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/converter/ConvertingComparator.java +++ b/spring-core/src/main/java/org/springframework/core/convert/converter/ConvertingComparator.java @@ -27,6 +27,9 @@ * A {@link Comparator} that converts values before they are compared. The specified * {@link Converter} will be used to convert each value before it passed to the underlying * {@code Comparator}. + * + *

Comparator 转换值在比较之前 + * Converter转换每一个值在传入底层Comparator之前 * * @author Phillip Webb * @since 3.2 diff --git a/spring-core/src/main/java/org/springframework/core/convert/converter/GenericConverter.java b/spring-core/src/main/java/org/springframework/core/convert/converter/GenericConverter.java index 09d3b1083733..b99f38c74763 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/converter/GenericConverter.java +++ b/spring-core/src/main/java/org/springframework/core/convert/converter/GenericConverter.java @@ -66,6 +66,7 @@ public interface GenericConverter { /** * Holder for a source-to-target class pair. + * 持有一组源到目标的类 */ final class ConvertiblePair { diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToArrayConverter.java b/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToArrayConverter.java index df3b730d11b8..9a1bf377eb0a 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToArrayConverter.java +++ b/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToArrayConverter.java @@ -31,6 +31,8 @@ * then delegates to {@link CollectionToArrayConverter} to perform the target * array conversion. * + *

转换一个array到另一个array,首先是否源array到list, + * 然后委托CollectionToArrayConverter去操作目标array转换 * @author Keith Donald * @author Phillip Webb * @since 3.0 diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToCollectionConverter.java b/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToCollectionConverter.java index 22373712694a..f576fa7e122c 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToCollectionConverter.java +++ b/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToCollectionConverter.java @@ -33,7 +33,7 @@ * Then adds each array element to the target collection. * Will perform an element conversion from the source component type * to the collection's parameterized type if necessary. - * + *

转换一个array到集合 * @author Keith Donald * @author Juergen Hoeller * @since 3.0 diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToObjectConverter.java b/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToObjectConverter.java index ef92f0bd1206..006f1d24b093 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToObjectConverter.java +++ b/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToObjectConverter.java @@ -28,6 +28,7 @@ * Converts an array to an Object by returning the first array element * after converting it to the desired target type. * + *

转换一个array到对象,返回第一个数组元素,当转换为期望的目标类型时 * @author Keith Donald * @since 3.0 */ diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/CollectionToArrayConverter.java b/spring-core/src/main/java/org/springframework/core/convert/support/CollectionToArrayConverter.java index ea79a065b6d7..4919960b562e 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/support/CollectionToArrayConverter.java +++ b/spring-core/src/main/java/org/springframework/core/convert/support/CollectionToArrayConverter.java @@ -32,6 +32,8 @@ * size of the source Collection. Then sets each collection element into the array. * Will perform an element conversion from the collection's parameterized type to the * array's component type if necessary. + * + *

转换一个集合到array * * @author Keith Donald * @since 3.0 diff --git a/spring-core/src/main/java/org/springframework/core/io/DefaultResourceLoader.java b/spring-core/src/main/java/org/springframework/core/io/DefaultResourceLoader.java index 34a15b7c7c2e..3e4e1be6affe 100644 --- a/spring-core/src/main/java/org/springframework/core/io/DefaultResourceLoader.java +++ b/spring-core/src/main/java/org/springframework/core/io/DefaultResourceLoader.java @@ -35,7 +35,8 @@ *

Will return a {@link UrlResource} if the location value is a URL, * and a {@link ClassPathResource} if it is a non-URL path or a * "classpath:" pseudo-URL. - * + *

ResourceLoader接口的默认实现类型,被ResourceEditor使用,同时作为AbstractApplicationContext的基类 + * * @author Juergen Hoeller * @since 10.03.2004 * @see FileSystemResourceLoader @@ -147,6 +148,7 @@ else if (location.startsWith(CLASSPATH_URL_PREFIX)) { *

The default implementation supports class path locations. This should * be appropriate for standalone implementations but can be overridden, * e.g. for implementations targeted at a Servlet container. + *

通过给定的path返回一个Resource处理默认支持class path地址, * @param path the path to the resource * @return the corresponding Resource handle * @see ClassPathResource diff --git a/spring-core/src/main/java/org/springframework/core/io/buffer/DefaultDataBufferFactory.java b/spring-core/src/main/java/org/springframework/core/io/buffer/DefaultDataBufferFactory.java index 4862b45ae9a6..ed5159b4f78c 100644 --- a/spring-core/src/main/java/org/springframework/core/io/buffer/DefaultDataBufferFactory.java +++ b/spring-core/src/main/java/org/springframework/core/io/buffer/DefaultDataBufferFactory.java @@ -24,7 +24,8 @@ * Default implementation of the {@code DataBufferFactory} interface. Allows for * specification of the default initial capacity at construction time, as well * as whether heap-based or direct buffers are to be preferred. - * + *

DataBufferFactory接口的默认实现类,允许指定默认的初始化容量, + * 也支持,heap或者直接缓存 * @author Arjen Poutsma * @since 5.0 */ diff --git a/spring-core/src/main/java/org/springframework/core/io/support/DefaultPropertySourceFactory.java b/spring-core/src/main/java/org/springframework/core/io/support/DefaultPropertySourceFactory.java index 5ff4c9dfed04..f011cf0d81c7 100644 --- a/spring-core/src/main/java/org/springframework/core/io/support/DefaultPropertySourceFactory.java +++ b/spring-core/src/main/java/org/springframework/core/io/support/DefaultPropertySourceFactory.java @@ -23,7 +23,8 @@ /** * The default implementation for {@link PropertySourceFactory}, * wrapping every resource in a {@link ResourcePropertySource}. - * + * + *

PropertySourceFactory接口的默认实现类,wrapping任何实现ResourcePropertySource接口的资源 * @author Juergen Hoeller * @since 4.3 * @see PropertySourceFactory diff --git a/spring-core/src/main/java/org/springframework/core/io/support/EncodedResource.java b/spring-core/src/main/java/org/springframework/core/io/support/EncodedResource.java index 73c9b158b299..50744c437c52 100644 --- a/spring-core/src/main/java/org/springframework/core/io/support/EncodedResource.java +++ b/spring-core/src/main/java/org/springframework/core/io/support/EncodedResource.java @@ -33,7 +33,7 @@ * *

Used as an argument for operations that support reading content with * a specific encoding, typically via a {@code java.io.Reader}. - * + *

持有组合Resource描述符包含一个指定编码或者用于读取的resource * @author Juergen Hoeller * @author Sam Brannen * @since 1.2.6 @@ -125,6 +125,7 @@ public boolean requiresReader() { * Open a {@code java.io.Reader} for the specified resource, using the specified * {@link #getCharset() Charset} or {@linkplain #getEncoding() encoding} * (if any). + *

打开一个Reader为一个特定的资源 * @throws IOException if opening the Reader failed * @see #requiresReader() * @see #getInputStream() @@ -144,6 +145,7 @@ else if (this.encoding != null) { /** * Open a {@code java.io.InputStream} for the specified resource, ignoring any * specified {@link #getCharset() Charset} or {@linkplain #getEncoding() encoding}. + *

打开一个InputStream为特定的resource * @throws IOException if opening the InputStream failed * @see #requiresReader() * @see #getReader() diff --git a/spring-core/src/main/java/org/springframework/core/io/support/LocalizedResourceHelper.java b/spring-core/src/main/java/org/springframework/core/io/support/LocalizedResourceHelper.java index 57f2645a986c..d7cf3811c227 100644 --- a/spring-core/src/main/java/org/springframework/core/io/support/LocalizedResourceHelper.java +++ b/spring-core/src/main/java/org/springframework/core/io/support/LocalizedResourceHelper.java @@ -26,13 +26,13 @@ /** * Helper class for loading a localized resource, * specified through name, extension and current locale. - * + *

加载本地化资源的helper类,通过name,扩展和当前locale * @author Juergen Hoeller * @since 1.2.5 */ public class LocalizedResourceHelper { - /** The default separator to use inbetween file name parts: an underscore */ + /** The default separator to use inbetween file name parts: an underscore 默认分割符 */ public static final String DEFAULT_SEPARATOR = "_"; @@ -80,6 +80,7 @@ public void setSeparator(String separator) { * *

If none of the specific files can be found, a resource * descriptor for the default location will be returned. + *

通过给定name,扩展,locale找到最合适的本地化资源 * @param name the name of the file, without localization part nor extension * @param extension the file extension (e.g. ".xls") * @param locale the current locale (may be {@code null}) diff --git a/spring-core/src/main/java/org/springframework/core/io/support/PropertiesLoaderSupport.java b/spring-core/src/main/java/org/springframework/core/io/support/PropertiesLoaderSupport.java index fb9508390e08..c1aa2bffefe7 100644 --- a/spring-core/src/main/java/org/springframework/core/io/support/PropertiesLoaderSupport.java +++ b/spring-core/src/main/java/org/springframework/core/io/support/PropertiesLoaderSupport.java @@ -31,7 +31,7 @@ * Base class for JavaBean-style components that need to load properties * from one or more resources. Supports local properties as well, with * configurable overriding. - * + *

JavaBean-style模块的基类,需要加载属性文件从一个或多个资源,也支持本地属性 * @author Juergen Hoeller * @since 1.2.2 */ diff --git a/spring-core/src/main/java/org/springframework/core/io/support/ResourceRegion.java b/spring-core/src/main/java/org/springframework/core/io/support/ResourceRegion.java index a76be60697aa..9aed7f955f8c 100644 --- a/spring-core/src/main/java/org/springframework/core/io/support/ResourceRegion.java +++ b/spring-core/src/main/java/org/springframework/core/io/support/ResourceRegion.java @@ -22,7 +22,7 @@ /** * Region of a {@link Resource} implementation, materialized by a {@code position} * within the {@link Resource} and a byte {@code count} for the length of that region. - * + *

Resource 区域的实现 * @author Arjen Poutsma * @since 4.3 */ diff --git a/spring-core/src/main/java/org/springframework/core/io/support/SpringFactoriesLoader.java b/spring-core/src/main/java/org/springframework/core/io/support/SpringFactoriesLoader.java index ef4525214fae..7d930dc65c94 100644 --- a/spring-core/src/main/java/org/springframework/core/io/support/SpringFactoriesLoader.java +++ b/spring-core/src/main/java/org/springframework/core/io/support/SpringFactoriesLoader.java @@ -48,7 +48,7 @@ * * where {@code example.MyService} is the name of the interface, and {@code MyServiceImpl1} * and {@code MyServiceImpl2} are two implementations. - * + *

用于框架内内部使用的通用工厂加载机制 * @author Arjen Poutsma * @author Juergen Hoeller * @author Sam Brannen diff --git a/spring-core/src/main/java/org/springframework/core/serializer/support/DeserializingConverter.java b/spring-core/src/main/java/org/springframework/core/serializer/support/DeserializingConverter.java index 8bee4ddd2fdb..0cee19392d7f 100644 --- a/spring-core/src/main/java/org/springframework/core/serializer/support/DeserializingConverter.java +++ b/spring-core/src/main/java/org/springframework/core/serializer/support/DeserializingConverter.java @@ -28,6 +28,7 @@ * {@link org.springframework.core.serializer.Deserializer} * to convert data in a byte array to an object. * + *

解析字节数组数据到一个对象 * @author Gary Russell * @author Mark Fisher * @author Juergen Hoeller diff --git a/spring-core/src/main/java/org/springframework/core/style/DefaultToStringStyler.java b/spring-core/src/main/java/org/springframework/core/style/DefaultToStringStyler.java index 97a6ce23ce7f..70abd831b70b 100644 --- a/spring-core/src/main/java/org/springframework/core/style/DefaultToStringStyler.java +++ b/spring-core/src/main/java/org/springframework/core/style/DefaultToStringStyler.java @@ -26,6 +26,7 @@ *

This class is used by {@link ToStringCreator} to style {@code toString()} * output in a consistent manner according to Spring conventions. * + *

spring默认的toString格式化, * @author Keith Donald * @author Juergen Hoeller * @since 1.2.2 diff --git a/spring-core/src/main/java/org/springframework/core/style/DefaultValueStyler.java b/spring-core/src/main/java/org/springframework/core/style/DefaultValueStyler.java index e32986f62969..9a5216183c0d 100644 --- a/spring-core/src/main/java/org/springframework/core/style/DefaultValueStyler.java +++ b/spring-core/src/main/java/org/springframework/core/style/DefaultValueStyler.java @@ -32,7 +32,7 @@ * *

Uses the reflective visitor pattern underneath the hood to nicely * encapsulate styling algorithms for each type of styled object. - * + *

转换一个对象到string格式,通常用于调试目的 * @author Keith Donald * @author Juergen Hoeller * @since 1.2.2 diff --git a/spring-core/src/main/java/org/springframework/core/task/support/ConcurrentExecutorAdapter.java b/spring-core/src/main/java/org/springframework/core/task/support/ConcurrentExecutorAdapter.java index 8f9f09eda598..e997c5634f1c 100644 --- a/spring-core/src/main/java/org/springframework/core/task/support/ConcurrentExecutorAdapter.java +++ b/spring-core/src/main/java/org/springframework/core/task/support/ConcurrentExecutorAdapter.java @@ -30,6 +30,7 @@ * hiding the TaskExecutor nature of a given object now, * solely exposing the standard Executor interface to a client. * + *

暴露 Executor接口为任何TaskExecutor * @author Juergen Hoeller * @since 2.5 * @see java.util.concurrent.Executor diff --git a/spring-core/src/main/java/org/springframework/core/type/StandardAnnotationMetadata.java b/spring-core/src/main/java/org/springframework/core/type/StandardAnnotationMetadata.java index ff2f1e695d7c..b8fb5c8c8058 100644 --- a/spring-core/src/main/java/org/springframework/core/type/StandardAnnotationMetadata.java +++ b/spring-core/src/main/java/org/springframework/core/type/StandardAnnotationMetadata.java @@ -28,7 +28,7 @@ /** * {@link AnnotationMetadata} implementation that uses standard reflection * to introspect a given {@link Class}. - * + *

AnnotationMetadata 实现通过标准的反射给定的类 * @author Juergen Hoeller * @author Mark Fisher * @author Chris Beams diff --git a/spring-core/src/main/java/org/springframework/lang/UsesSunHttpServer.java b/spring-core/src/main/java/org/springframework/lang/UsesSunHttpServer.java index 06daac43abd0..6540ae327d71 100644 --- a/spring-core/src/main/java/org/springframework/lang/UsesSunHttpServer.java +++ b/spring-core/src/main/java/org/springframework/lang/UsesSunHttpServer.java @@ -26,6 +26,7 @@ * Indicates that the annotated element uses the Http Server available in * {@code com.sun.*} classes, which is only available on a Sun/Oracle JVM. * + *

指定被标记的属性,在{@code com.sun.*}类里面可以使用http server,只在 Sun/Oracle JVM上可用 * @author Stephane Nicoll * @since 4.1 */ diff --git a/spring-core/src/main/java/org/springframework/lang/UsesSunMisc.java b/spring-core/src/main/java/org/springframework/lang/UsesSunMisc.java index 5bcbd4a90f55..beaf7278e617 100644 --- a/spring-core/src/main/java/org/springframework/lang/UsesSunMisc.java +++ b/spring-core/src/main/java/org/springframework/lang/UsesSunMisc.java @@ -25,7 +25,7 @@ /** * Indicates that the annotated element uses an API from the {@code sun.misc} * package. - * + *

指示被标记的元素,可以使用{@code sun.misc} api * @author Stephane Nicoll * @since 4.3 */ diff --git a/spring-core/src/main/java/org/springframework/objenesis/SpringObjenesis.java b/spring-core/src/main/java/org/springframework/objenesis/SpringObjenesis.java index 41d9bdf6c661..9f9a11061c93 100644 --- a/spring-core/src/main/java/org/springframework/objenesis/SpringObjenesis.java +++ b/spring-core/src/main/java/org/springframework/objenesis/SpringObjenesis.java @@ -27,6 +27,7 @@ * providing a cache based on {@code Class} keys instead of class names, * and allowing for selective use of the cache. * + *

提供一种基于{@code Class} keys 的缓存,不是class名称,通过允许选择性的使用缓存 * @author Juergen Hoeller * @since 4.2 * @see #isWorthTrying() @@ -40,6 +41,8 @@ public class SpringObjenesis implements Objenesis { * out that Objenesis isn't working at runtime, triggering the fallback code path * immediately: Most importantly, this means that all CGLIB AOP proxies will be * created through regular instantiation via a default constructor. + * 系统属性表明spirng去忽略Objenesis,不试图去使用它, + * */ public static final String IGNORE_OBJENESIS_PROPERTY_NAME = "spring.objenesis.ignore"; @@ -55,6 +58,8 @@ public class SpringObjenesis implements Objenesis { /** * Create a new {@code SpringObjenesis} instance with the * standard instantiator strategy. + * + * 创建一个实例,包含标准的实例化策略 */ public SpringObjenesis() { this(null); @@ -63,12 +68,15 @@ public SpringObjenesis() { /** * Create a new {@code SpringObjenesis} instance with the * given standard instantiator strategy. + * + * 根据给定的标准实例化策略创建对象, * @param strategy the instantiator strategy to use */ public SpringObjenesis(InstantiatorStrategy strategy) { this.strategy = (strategy != null ? strategy : new StdInstantiatorStrategy()); // Evaluate the "spring.objenesis.ignore" property upfront... + // 评估spring.objenesis.ignore属性标记 if (SpringProperties.getFlag(SpringObjenesis.IGNORE_OBJENESIS_PROPERTY_NAME)) { this.worthTrying = Boolean.FALSE; } @@ -81,6 +89,7 @@ public SpringObjenesis(InstantiatorStrategy strategy) { *

If the configured Objenesis instantiator strategy has been identified to not * work on the current JVM at all or if the "spring.objenesis.ignore" property has * been set to "true", this method returns {@code false}. + *

返回是否这个Objenesis实例是否值得去创建实例 */ public boolean isWorthTrying() { return (this.worthTrying != Boolean.FALSE); @@ -88,6 +97,7 @@ public boolean isWorthTrying() { /** * Create a new instance of the given class via Objenesis. + *

通过给定的Objenesis创建一个新实例 * @param clazz the class to create an instance of * @param useCache whether to use the instantiator cache * (typically {@code true} but can be set to {@code false} @@ -135,6 +145,8 @@ protected ObjectInstantiator newInstantiatorOf(Class clazz) { // Indicates that the chosen instantiation strategy does not work on the given JVM. // Typically a failure to initialize the default SunReflectionFactoryInstantiator. // Let's assume that any subsequent attempts to use Objenesis will fail as well... + // 显示给定的实例化测试不能工作为给定的jvm上,通常在初始化默认的SunReflectionFactoryInstantiator时发生错误 + // 这样我们判断任何后面的试图通过Objenesis同样会失败 this.worthTrying = Boolean.FALSE; } } @@ -143,6 +155,7 @@ protected ObjectInstantiator newInstantiatorOf(Class clazz) { catch (NoClassDefFoundError err) { // Happening on the production version of Google App Engine, coming out of the // restricted "sun.reflect.ReflectionFactory" class... + // 当在Google App Engine生产环境上回发生, if (currentWorthTrying == null) { this.worthTrying = Boolean.FALSE; } diff --git a/spring-core/src/main/java/org/springframework/util/LinkedCaseInsensitiveMap.java b/spring-core/src/main/java/org/springframework/util/LinkedCaseInsensitiveMap.java index 91e4b1f41dbc..7b6663c1ea24 100644 --- a/spring-core/src/main/java/org/springframework/util/LinkedCaseInsensitiveMap.java +++ b/spring-core/src/main/java/org/springframework/util/LinkedCaseInsensitiveMap.java @@ -29,7 +29,7 @@ * while allowing for contains, get and remove calls with any case of key. * *

Does not support {@code null} keys. - * + *

保存大小写敏感的key * @author Juergen Hoeller * @since 3.0 */ diff --git a/spring-core/src/main/java/org/springframework/util/MimeType.java b/spring-core/src/main/java/org/springframework/util/MimeType.java index d3eeae3486f3..5d577d51afee 100644 --- a/spring-core/src/main/java/org/springframework/util/MimeType.java +++ b/spring-core/src/main/java/org/springframework/util/MimeType.java @@ -39,7 +39,10 @@ *

Consists of a {@linkplain #getType() type} and a {@linkplain #getSubtype() subtype}. * Also has functionality to parse media types from a string using * {@link #valueOf(String)}. For more parsing options see {@link MimeTypeUtils}. - * + * + *

代表一个MIME类型,最初定义在RFC 2046和随后使用其他互联网协议包括HTTP。 + * 这个类不支持q-参数在HTTP内容协商里面 可以在spring-web模块MediaType中找到 + * * @author Arjen Poutsma * @author Juergen Hoeller * @author Rossen Stoyanchev @@ -59,7 +62,7 @@ public class MimeType implements Comparable, Serializable { private static final BitSet TOKEN; static { - // variable names refer to RFC 2616, section 2.2 + // variable names refer to RFC 2616, section 2.2 变量名 BitSet ctl = new BitSet(128); for (int i = 0; i <= 31; i++) { ctl.set(i); @@ -105,6 +108,7 @@ public class MimeType implements Comparable, Serializable { * Create a new {@code MimeType} for the given primary type. *

The {@linkplain #getSubtype() subtype} is set to "*", * and the parameters are empty. + *

创建一个MimeType根据给定的类型,subtype设置为 * * @param type the primary type * @throws IllegalArgumentException if any of the parameters contains illegal characters */ @@ -114,6 +118,7 @@ public MimeType(String type) { /** * Create a new {@code MimeType} for the given primary type and subtype. + *

创建一个MimeType根据给定的类型和子类型 *

The parameters are empty. * @param type the primary type * @param subtype the subtype @@ -189,6 +194,7 @@ public MimeType(String type, String subtype, Map parameters) { /** * Checks the given token string for illegal characters, as defined in RFC 2616, * section 2.2. + *

检查给定的token是否非法, * @throws IllegalArgumentException in case of illegal characters * @see HTTP 1.1, section 2.2 */ @@ -233,6 +239,7 @@ protected String unquote(String s) { /** * Indicates whether the {@linkplain #getType() type} is the wildcard character * * or not. + *

检查type是否是统配符 * */ public boolean isWildcardType() { return WILDCARD_TYPE.equals(getType()); @@ -303,6 +310,8 @@ public Map getParameters() { *

For instance, {@code text/*} includes {@code text/plain} and {@code text/html}, * and {@code application/*+xml} includes {@code application/soap+xml}, etc. This * method is not symmetric. + * + *

判断该MimeType是否包含给定MimeType * @param other the reference media type with which to compare * @return {@code true} if this media type includes the given media type; * {@code false} otherwise @@ -347,6 +356,7 @@ else if (getType().equals(other.getType())) { *

For instance, {@code text/*} is compatible with {@code text/plain}, * {@code text/html}, and vice versa. In effect, this method is similar to * {@link #includes}, except that it is symmetric. + *

判断该MimeType是否兼容给定MimeType * @param other the reference media type with which to compare * @return {@code true} if this media type is compatible with the given media type; * {@code false} otherwise diff --git a/spring-core/src/main/java/org/springframework/util/StringValueResolver.java b/spring-core/src/main/java/org/springframework/util/StringValueResolver.java index fe7799d3fc0f..e53131ca0b6a 100644 --- a/spring-core/src/main/java/org/springframework/util/StringValueResolver.java +++ b/spring-core/src/main/java/org/springframework/util/StringValueResolver.java @@ -19,6 +19,8 @@ /** * Simple strategy interface for resolving a String value. * Used by {@link org.springframework.beans.factory.config.ConfigurableBeanFactory}. + * + *

简单策略接口为解析一个string值 * * @author Juergen Hoeller * @since 2.5 @@ -31,6 +33,7 @@ public interface StringValueResolver { /** * Resolve the given String value, for example parsing placeholders. + * 解析给定string值,例如解析占位符 * @param strVal the original String value * @return the resolved String value */