|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2018 the original author or authors. |
| 2 | + * Copyright 2002-2023 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
39 | 39 |
|
40 | 40 | /**
|
41 | 41 | * A powerful and highly configurable {@link EvaluationContext} implementation.
|
42 |
| - * This context uses standard implementations of all applicable strategies, |
43 |
| - * based on reflection to resolve properties, methods and fields. |
44 | 42 | *
|
45 |
| - * <p>For a simpler builder-style context variant for data-binding purposes, |
| 43 | + * <p>This context uses standard implementations of all applicable strategies, |
| 44 | + * based on reflection to resolve properties, methods, and fields. Note, however, |
| 45 | + * that you may need to manually configure a {@code StandardTypeLocator} with a |
| 46 | + * specific {@link ClassLoader} to ensure that the SpEL expression parser is able |
| 47 | + * to reliably locate user types. See {@link #setTypeLocator(TypeLocator)} for |
| 48 | + * details. |
| 49 | + * |
| 50 | + * <p>For a simpler, builder-style context variant for data-binding purposes, |
46 | 51 | * consider using {@link SimpleEvaluationContext} instead which allows for
|
47 |
| - * opting into several SpEL features as needed by specific evaluation cases. |
| 52 | + * opting into several SpEL features as needed by specific use cases. |
48 | 53 | *
|
49 | 54 | * @author Andy Clement
|
50 | 55 | * @author Juergen Hoeller
|
@@ -182,11 +187,29 @@ public BeanResolver getBeanResolver() {
|
182 | 187 | return this.beanResolver;
|
183 | 188 | }
|
184 | 189 |
|
| 190 | + /** |
| 191 | + * Set the {@link TypeLocator} to use to find types, either by short or |
| 192 | + * fully-qualified name. |
| 193 | + * <p>By default, a {@link StandardTypeLocator} will be used. |
| 194 | + * <p><strong>NOTE</strong>: Even if a {@code StandardTypeLocator} is |
| 195 | + * sufficient, you may need to manually configure a {@code StandardTypeLocator} |
| 196 | + * with a specific {@link ClassLoader} to ensure that the SpEL expression |
| 197 | + * parser is able to reliably locate user types. |
| 198 | + * @param typeLocator the {@code TypeLocator} to use |
| 199 | + * @see StandardTypeLocator#StandardTypeLocator(ClassLoader) |
| 200 | + * @see #getTypeLocator() |
| 201 | + */ |
185 | 202 | public void setTypeLocator(TypeLocator typeLocator) {
|
186 | 203 | Assert.notNull(typeLocator, "TypeLocator must not be null");
|
187 | 204 | this.typeLocator = typeLocator;
|
188 | 205 | }
|
189 | 206 |
|
| 207 | + /** |
| 208 | + * Get the configured {@link TypeLocator} that will be used to find types, |
| 209 | + * either by short or fully-qualified name. |
| 210 | + * <p>See {@link #setTypeLocator(TypeLocator)} for further details. |
| 211 | + * @see #setTypeLocator(TypeLocator) |
| 212 | + */ |
190 | 213 | @Override
|
191 | 214 | public TypeLocator getTypeLocator() {
|
192 | 215 | if (this.typeLocator == null) {
|
|
0 commit comments