Commit Graph

1328 Commits

Author SHA1 Message Date
XenoAmess 3b12beb1b8
Simplify if-statements with instanceof checks
Closes gh-25449
2020-07-22 10:34:27 +02:00
XenoAmess c7f44ff671
Fix links in Javadoc
Closes gh-25448
2020-07-22 10:24:55 +02:00
Juergen Hoeller 88394bff66 Merge branch '5.2.x' 2020-07-20 07:21:36 +02:00
Juergen Hoeller f1345aadf5 Defensively access existing beanDefinitionMap entries
See gh-22263
2020-07-20 07:04:45 +02:00
Juergen Hoeller e4e54b3c4a Merge branch '5.2.x' 2020-07-19 20:01:21 +02:00
Juergen Hoeller 30bc5e09e7 Defensively catch NoSuchBeanDefinitionException on beanDefinitionNames traversal
Closes gh-22263
2020-07-19 19:56:33 +02:00
Juergen Hoeller 198d64d539 Merge branch '5.2.x'
# Conflicts:
#	build.gradle
2020-07-17 17:52:08 +02:00
Juergen Hoeller 5846d9c2ea Clarify enforceInitMethod/enforceDestroyMethod default values
Closes gh-25402
2020-07-17 17:44:59 +02:00
Juergen Hoeller 56c661829b Avoid package cycle through dedicated ResourcePropertiesPersister
See gh-25151
2020-06-23 16:54:55 +02:00
Sam Brannen ab0e651547 Polish SerializationTestUtils, clean up warnings, etc. 2020-06-20 18:17:03 +02:00
Sam Brannen 9d5881e0ad Suppress warnings, remove unused code, etc. 2020-06-20 17:15:35 +02:00
Sébastien Deleuze 63dff520e6 Disable and remove unsupported features from native images
This commit removes load time weaving, CGLIB and Objenesis support
from native images.

GraalDetector has been removed for now because of
https://github.com/oracle/graal/issues/2594. It should be reintroduced
when this bug will be fixed with NativeImageDetector class name.

Closes gh-25179
2020-06-20 17:05:13 +02:00
Sam Brannen c418cef68f Merge branch '5.2.x' 2020-06-19 14:42:50 +02:00
Sam Brannen d07be59801 Improve Javadoc for @Value regarding supported expressions
Closes gh-25284
2020-06-19 14:32:36 +02:00
Sébastien Deleuze 1e501f2583 Provide a flag to disable XML support
This commit introduces a spring.xml.ignore system property
which when set to true avoid initializing XML infrastructure.

A typical use case is optimizing GraalVM native image footprint
for applications not using XML. In order to be effective, those
classes should be initialized at build time:

- org.springframework.util.DefaultPropertiesPersister
- org.springframework.core.io.support.PropertiesLoaderUtils
- org.springframework.web.servlet.function.support.RouterFunctionMapping
- org.springframework.web.client.RestTemplate
- org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver
- org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport
- org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter
- org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter
- org.springframework.http.codec.support.BaseDefaultCodecs
- org.springframework.beans.PropertyEditorRegistrySupport

Closes gh-25151
2020-06-19 09:42:12 +02:00
Juergen Hoeller d36407d585 Deprecate rarely used bean definition variants
Closes gh-24875
2020-06-17 10:59:55 +02:00
Сергей Цыпанов 7949937655 Remove redundant assignment of default values to volatile fields 2020-06-17 10:50:51 +02:00
Juergen Hoeller 188722a358 Merge branch '5.2.x' 2020-06-12 00:52:00 +02:00
Juergen Hoeller b24a337146 Polishing 2020-06-12 00:39:58 +02:00
Juergen Hoeller 1279b3b822 Merge branch '5.2.x'
# Conflicts:
#	spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java
#	spring-context-support/src/main/java/org/springframework/cache/jcache/config/AbstractJCacheConfiguration.java
2020-06-11 23:53:27 +02:00
Juergen Hoeller 9138a04a0a Polishing 2020-06-11 23:45:23 +02:00
GardenLee eb3be3ad88 Refactor method name dispatching to switch statements in AutowireUtils
Closes gh-25199
2020-06-09 23:46:29 +02:00
Juergen Hoeller 7207f7645c Deprecate InstantiationAwareBeanPostProcessorAdapter
Consistently relying on default methods in the corresponding interfaces.

Closes gh-25165
2020-05-29 23:07:10 +02:00
Juergen Hoeller 42ff01b5aa Merge branch '5.2.x' 2020-05-29 15:57:32 +02:00
Juergen Hoeller 914425eefa Polishing 2020-05-29 15:52:39 +02:00
Sam Brannen 5f9e9513ef Merge branch '5.2.x' 2020-05-29 13:33:34 +02:00
Sam Brannen 768257567d Make use of custom types configurable in YamlProcessor
Prior to this commit, there was no easy way to restrict what types could
be loaded from a YAML document in subclasses of YamlProcessor such as
YamlPropertiesFactoryBean and YamlMapFactoryBean.

This commit introduces a setSupportedTypes(Class<?>...) method in
YamlProcessor in order to address this. If no supported types are
configured, all types encountered in YAML documents will be supported.
If an unsupported type is encountered, an IllegalStateException will be
thrown when the corresponding YAML node is processed.

Closes gh-25152
2020-05-29 13:32:52 +02:00
Juergen Hoeller 929244215c Merge branch '5.2.x'
# Conflicts:
#	build.gradle
2020-05-26 23:37:53 +02:00
Juergen Hoeller 27d5fdc5aa Polishing 2020-05-26 23:35:38 +02:00
Juergen Hoeller dfa948c2ca Introduce AutowireCandidateResolver.cloneIfNecessary() method
Closes gh-25131
2020-05-26 23:33:39 +02:00
Juergen Hoeller f9aae8dd5a Consistently determine minimum number of arguments from specified index
Closes gh-25130
2020-05-26 23:33:02 +02:00
Juergen Hoeller 9999414b3b Merge branch '5.2.x' 2020-05-18 14:24:33 +02:00
Juergen Hoeller 35f3277910 Revised javadoc note on Lookup annotation limitations/recommendations
Closes gh-25044
2020-05-18 14:21:14 +02:00
Сергей Цыпанов 703d54677e Avoid unnecessary boxing/unboxing of primitives
Closes gh-25080
2020-05-15 18:01:59 +02:00
Juergen Hoeller fe33822fa7 Polishing 2020-05-14 00:23:20 +02:00
Juergen Hoeller 5de6ae6fca Ignore resolved bean from non-active scope in getIfAvailable/getIfUnique
Closes gh-24822
2020-05-13 19:25:20 +02:00
Juergen Hoeller a3c5625d4e Internal cache of pre-filtered BeanPostProcessors (for faster iteration)
Also includes bulk addition in PostProcessorRegistrationDelegate.

Closes gh-24681
Closes gh-24756
2020-05-13 15:53:48 +02:00
Sam Brannen 12e05280ad Upgrade to AssertJ 3.16 2020-05-06 15:22:23 +02:00
Sam Brannen afc398333e Polishing 2020-04-28 16:34:58 +02:00
Jendrik Johannes 9bd60f6554 Update to Gradle 6.2
- Build Scan plugin is now Gradle Enterprise plugin applied in settings
- Compile task dependencies are now defined through classpath
- Test fixture publication can be disabled through public API

Closes gh-24384
2020-04-28 15:03:03 +02:00
Sam Brannen e74f868a23 Revise generics support in BeanUtils.copyProperties()
Closes gh-24187
2020-04-28 13:25:28 +02:00
Kunal Patel 89ee0b077f Honor generic type information in BeanUtils.copyProperties()
Prior to this commit, BeanUtils.copyProperties() ignored generic type
information when comparing candidate source and target property types.

This commit reworks the implementation of BeanUtils.copyProperties() so
that generic type information is taken into account when copying
properties.

See gh-24281
2020-04-28 13:25:28 +02:00
Sam Brannen cdde19c0bc Polishing 2020-04-28 13:25:00 +02:00
Juergen Hoeller af65b1ca62 Polishing 2020-04-25 16:37:16 +02:00
Juergen Hoeller e36a415994 Explain FactoryBean lifecycle management and destroy method handling
Closes gh-24948
2020-04-25 16:34:59 +02:00
Juergen Hoeller 401f9599ca Caching of autowire candidate metadata for injection point matching
Closes gh-24904
2020-04-25 16:34:28 +02:00
Juergen Hoeller 0552102780 Enforce limit for storing suppressed exceptions
Closes gh-24902
2020-04-25 16:33:35 +02:00
liuhy365 3af54692fa Fix parent bean factory self-reference issue.
If set parent bean factory to self, once try to get an undefined bean,  bellow condition
if (parentBeanFactory != null && !containsBeanDefinition(beanName)) {
...
}
will always be true and  StackOverflowError will be thrown.
Sometimes, this issue is hard to detect during runtime, if self-reference is not allowed here, error will be found at the early time of startup.
Also, a self-reference parent bean factory is valueless.
2020-04-25 16:28:09 +02:00
陈其苗 1e1ea34e87 Fix typo in Javadoc
See gh-24908
2020-04-15 08:36:33 +02:00
Sam Brannen 6c26765985 Document default constructor as fallback for non-@Autowired constructors
Prior to this commit, it was unclear in the documentation that a default
constructor will be used by default for autowiring if multiple
constructors are present and none of them is annotated with @Autowired.

This commit improves the documentation in this regard.

Closes gh-24838
2020-04-07 14:35:40 +02:00
Juergen Hoeller a70ad0094f Clear by-type cache in case of no pre-existing bean definition as well
Closes gh-24852
2020-04-03 21:12:03 +02:00
Juergen Hoeller 151a18d691 Explicit notes on BeanFactory.getType vs bean class in bean definition
Closes gh-24816
2020-04-03 21:11:07 +02:00
陈其苗 13970ae528 Use autoboxing instead of explicit wrapping in tests
Closes gh-24801
2020-04-01 14:34:20 +02:00
Sam Brannen e26764d249 Remove duplicate words in documentation and polish Javadoc 2020-03-31 12:17:58 +02:00
Sam Brannen 53106d5741 Polishing 2020-03-31 10:40:04 +02:00
Qimiao Chen 821984a5cf
Remove unnecessary assignment in PropertiesBeanDefinitionReader
Closes gh-24804
2020-03-30 12:41:19 +02:00
Qimiao Chen 5d6139eb7a
Set initialValue of NamedThreadLocal in XmlBeanDefinitionReader
This commit overrides initialValue() of NamedThreadLocal to lazily initialize
the set used in XmlBeanDefinitionReader.

Closes gh-24800
2020-03-27 14:58:55 +01:00
Qimiao Chen c77853b766
Remove unnecessary mem alloc in CollectingReaderEventListener
Closes gh-24799
2020-03-27 11:00:05 +01:00
Sam Brannen 3e9d51220d
Update spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java 2020-03-26 15:47:46 +01:00
陈其苗 072961b91a Fix typo in BeanDefinitionParserDelegate 2020-03-26 20:11:06 +08:00
Tom van den Berge 107f88a7e4 Allow non-public Kotlin classes/ctors to be instantiated
Closes gh-24712
2020-03-23 10:47:28 +01:00
Sam Brannen 90268de9c0 Polish implementation of BeanDefinitionReaderUtils.generateBeanName()
Closes gh-24739
2020-03-20 19:13:29 +01:00
Qimiao Chen 201827cb0b
Fix exception message in getMergedBeanDefinition
Closes gh-24686

Co-authored-by: Sam Brannen <sbrannen@pivotal.io>
2020-03-13 09:47:57 +01:00
Christoph Dreis 2093e35f27 Avoid unnecessary sorting 2020-03-04 19:10:14 +00:00
Juergen Hoeller c0fbf6fca1 Polishing 2020-02-24 19:50:12 +01:00
Rossen Stoyanchev 97ba00eff2 Use try-with-resource in XmlBeanDefinitionReader
Closes gh-24492
2020-02-20 17:28:30 +00:00
Qimiao Chen acae174f8f
Fix javadoc in DependencyDescriptor
Closes gh-24551
2020-02-19 11:04:25 +01:00
ZhangT 6add7b4dec
Polishing
Closes gh-24543
2020-02-17 17:33:39 +01:00
Sam Brannen 51fa98a1b2 Apply compiler conventions to test fixtures 2020-02-07 11:04:03 +01:00
Juergen Hoeller b23049bd27 Polishing 2020-02-06 12:59:55 +01:00
Juergen Hoeller 669a689a50 Prevent unnecessary refresh for InjectionMetadata.EMPTY
Closes gh-24485
2020-02-06 12:44:05 +01:00
Сергей Цыпанов a36168c972
Produce less String-related garbage when generating bean names
Closes gh-24476
2020-02-04 11:18:48 +01:00
Johnny Lim f01de79fe2 Polish 2020-01-31 10:38:36 +00:00
Сергей Цыпанов 64440a5f04 Some trivial improvements to reduce allocation pressure
Closes gh-24447
2020-01-28 11:07:40 +01:00
Sam Brannen b34404916a Update copyright date 2020-01-17 18:15:16 +01:00
Сергей Цыпанов 3adc7c3059 Hoist concatenation of two constant Strings out of loops
Closes gh-24388
2020-01-17 16:59:39 +01:00
stsypanov 8e5cad2af3 Add fast path for ClassUtils.hasMethod() 2020-01-08 18:52:15 +01:00
Sam Brannen 59ade91694 Use HTTPS in link
See gh-24268
2020-01-06 14:45:17 +01:00
Sam Brannen c1d0060a6f Recommend third-party alternatives in BeanUtils Javadoc
See gh-24268
2020-01-06 14:41:00 +01:00
Rossen Stoyanchev 510ef1ab2e Polishing contribution
See gh-24287
2020-01-03 11:21:07 +00:00
KangZhiDong f585eb0b79 Fix Javadoc typos
See gh-24287
2020-01-03 11:21:07 +00:00
Sam Brannen 57b771ba92 Move common FactoryMethods to spring-beans test fixtures
See gh-23550
2020-01-02 16:01:35 +01:00
Sam Brannen 94f8ef08e2 Move common TestPrincipal to spring-core test fixtures
See gh-23550
2020-01-02 16:01:35 +01:00
Sam Brannen 7cd4ddf5fc Rename test fixture package in spring-beans
See gh-23550
2020-01-02 16:01:35 +01:00
Sam Brannen 4260c34b47 Rename test fixture package in spring-core
See gh-23550
2020-01-02 16:01:34 +01:00
Sam Brannen 61d4ee594d Use Gradle test fixture support for spring-beans and spring-context
See gh-23550
2020-01-02 16:01:34 +01:00
Sam Brannen 5718bf424b Use Gradle test fixture support for spring-core
See gh-23550
2020-01-02 16:01:34 +01:00
Juergen Hoeller fa8f08391f Consistent use of annotation-api dependency instead of tomcat-embed-core 2019-12-12 17:21:41 +01:00
Juergen Hoeller 9af8dc0980 Polishing 2019-12-11 17:04:49 +01:00
Johnny Lim 8ac222467b Short-circuit boolean logic in AbstractBeanDefinition.equals()
Closes gh-24185
2019-12-11 16:46:47 +01:00
stsypanov 484006ce90 Hoist Class.getName() from String concatenation to dodge an issue related to profile pollution 2019-12-06 17:36:07 +01:00
Juergen Hoeller 32e7adfa32 Polishing 2019-12-01 02:00:40 +01:00
Juergen Hoeller 91b557eb4b Polishing 2019-12-01 01:21:53 +01:00
Sam Brannen d9ebc3bbc4 Polish StringArrayPropertyEditor[Tests] 2019-11-29 14:55:18 +01:00
stsypanov 62ca7c4e8f Hoist constant byte[] out of loop 2019-11-27 19:19:36 +01:00
Sam Brannen 59e250c93c Consistent use of SCOPE_PROTOTYPE and SCOPE_SINGLETON constants
Closes gh-19905
2019-11-24 13:49:43 +01:00
Juergen Hoeller b5529f3f2b Restore short-circuiting in equals implementation
Closes gh-24048
2019-11-21 18:20:17 +01:00
stsypanov 1f3b595a03 Use String.isEmpty() instead of String.equals("") 2019-11-21 16:42:01 +01:00
Qimiao Chen bb2e3ce6d1 Polish AbstractBeanDefinition
Closes gh-24048
2019-11-21 15:26:42 +01:00
Sam Brannen d397baa559 Polish Javadoc for AutowiredAnnotationBeanPostProcessor 2019-11-15 12:43:55 +01:00
SchutzeHades 834ebc44f8 Fix inappropriate eager init. 2019-11-14 10:13:55 +01:00
Juergen Hoeller 22211a01ce Polishing 2019-11-13 17:23:23 +01:00
GungnirLaevatain 4bbf2d5785 polish 2019-11-12 17:40:28 +01:00
stsypanov 92efe95069 Simplify ConstructorResolver: do not sort intermediate array 2019-11-11 15:42:35 +01:00
Qimiao Chen 9b8da04e64 Delete unnecessary variable assignment
Closes gh-23955
2019-11-08 13:39:02 +01:00
Juergen Hoeller 6a48bb7b4d Polishing 2019-11-07 22:08:29 +01:00
stsypanov f5ae3c77c6 Use Method::getParameterCount where possible 2019-11-07 18:00:15 +01:00
Sam Brannen 29b31cad48 Align implementations of StringToUUIDConverter and UUIDEditor
Closes gh-23940
2019-11-06 14:21:52 +01:00
Sam Brannen 9f00eb68e9 Clean up warnings 2019-10-30 19:14:58 +01:00
Juergen Hoeller 248ad0fa79 Expose primary flag on BeanDefinitionBuilder
Closes gh-23794
2019-10-30 01:04:41 +01:00
Sam Brannen 2482209437 Polish Javadoc @param order 2019-10-29 12:49:05 +01:00
Sam Brannen 26ee9c68eb Document [Priority]Ordered support for Bean[Factory]PostProcessor
Prior to this commit, it was not clear from the Javadoc for
BeanPostProcess and BeanFactoryPostProcessor that such components can
be ordered by implementing Ordered or PriorityOrdered.

This commit improves the documentation for BPP and BFPP to make this
support explicit.

Closes gh-23636
2019-09-26 14:24:33 +02:00
Juergen Hoeller 47a24ac378 Upgrade to Aalto 1.2.2, Protobuf 3.10, Apache Johnzon 1.2, SnakeYAML 1.25, OpenPDF 1.3.11, FreeMarker 2.3.29 2019-09-25 23:49:15 +02:00
Juergen Hoeller 07df1ce7d2 Update genericBeanDefinitionEquality test to AssertJ usage on master
See gh-23593
2019-09-25 13:07:27 +02:00
Juergen Hoeller bd70f10d2b Merge branch '5.1.x'
# Conflicts:
#	build.gradle
#	spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java
#	spring-aspects/spring-aspects.gradle
#	spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java
#	spring-beans/src/main/java/org/springframework/beans/factory/support/GenericBeanDefinition.java
#	spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java
#	spring-orm/spring-orm.gradle
#	spring-test/spring-test.gradle
2019-09-25 12:43:24 +02:00
Juergen Hoeller bb6f9bb6d4 Polishing 2019-09-25 12:14:48 +02:00
Juergen Hoeller da44a247cb Efficient concurrency in MethodOverrides through CopyOnWriteArraySet
Also restores immediate MethodOverrides instance in AbstractBeanDefinition, avoiding potential lazy-init race condition.

Closes gh-23448
2019-09-25 12:09:16 +02:00
Juergen Hoeller 20fc7e178a Consistent equality check for parent name and indexed arguments
Closes gh-23593
2019-09-25 12:07:29 +02:00
Juergen Hoeller e68132686d Restore lenient target type handling for FactoryBean definitions
Closes gh-23561
2019-09-20 21:54:32 +02:00
Sam Brannen a51dc84cb1 Fix Checkstyle violation 2019-09-17 13:29:22 +02:00
Sam Brannen 9517372e5f Re-enable DLBFTests.prototypeCreationWithConstructorArgumentsIsFastEnough() 2019-09-17 13:24:53 +02:00
Sam Brannen a93f3ddfe4 Polish DefaultListableBeanFactoryTests 2019-09-17 13:17:22 +02:00
Sam Brannen c8e47f578f Merge branch '5.1.x' 2019-09-17 13:13:02 +02:00
Sam Brannen b2aad1c3b1 Ensure bean definitions can be removed concurrently
Prior to this commit, concurrent invocations of
DefaultListableBeanFactory.removeBeanDefinition() could result in a
NullPointerException.

This commit fixes this by adding an appropriate not-null check in
resetBeanDefinition().

Closes gh-23542
2019-09-17 13:09:08 +02:00
Sam Brannen 7a1a8e1623 Polish DefaultListableBeanFactoryTests 2019-09-17 10:44:45 +02:00
Phillip Webb d945ae9191 Add blank line between java and javax imports
See gh-23539

Co-authored-by: Sam Brannen <sbrannen@pivotal.io>
2019-09-16 13:41:59 +02:00
Sam Brannen e62cb6bc56 Merge branch '5.1.x' 2019-09-12 14:03:12 +02:00
GungnirLaevatain 9db4118180 Fix DefaultListableBeanFactory#copyConfigurationFrom
Prior to this commit, the copyConfigurationFrom(ConfigurableBeanFactory)
method in DefaultListableBeanFactory cloned its own AutowireCandidateResolver
type instead of the resolver type from the supplied ConfigurableBeanFactory.

This commit fixes that by cloning the resolver type from the supplied
ConfigurableBeanFactory.

Closes gh-23569
2019-09-12 13:58:24 +02:00
Sam Brannen 591995ecc8 Polish and revive disabled tests
This commit revives some previously disabled tests and converts
some usage of @Disabled to @EnabledForTestGroups(...).
2019-09-06 15:57:27 +02:00
Sam Brannen c80705a708 Polishing 2019-09-05 13:20:20 +02:00
Sam Brannen ce178f76eb Add missing Temporal tests in BeanUtilsTests
This change will help to serve as a regression test.
2019-09-05 13:14:39 +02:00
Phillip Webb deba2ed1b3 Add blank line between java and javax imports
See gh-23539
2019-09-04 22:05:46 -07:00
Sam Brannen f54395b261 Polish BeanUtilsTests 2019-09-04 16:53:29 +02:00
Sam Brannen 803643559a Merge branch '5.1.x' 2019-09-04 16:24:44 +02:00
Sam Brannen d036b5a283 Do not treat void and Void as simple types in BeanUtils
Prior to this commit, the isSimpleProperty() and isSimpleValueType()
methods in BeanUtils treated void and Void as simple types; however,
doing so does not make sense in this context, since void implies the
lack of a property or value.

This commit addresses this by explicitly excluding void and Void in the
logic in isSimpleValueType().

This commit also simplifies the implementation of
ViewResolutionResultHandler.supports(HandlerResult) to take advantage
of this change.

Closes gh-23573
2019-09-04 15:48:40 +02:00
Juergen Hoeller 48934cba1b Polishing 2019-09-04 12:19:08 +02:00
Juergen Hoeller 3bc27e8d14 Streamline AnnotationFilter usage with the MergedAnnotations API
MergedAnnotations provides 'from' variants with RepeatableContainers but without AnnotationFilter argument now, avoiding the need to refer to AnnotationFilter.PLAIN as a default at call sites.
2019-09-04 12:18:49 +02:00
Juergen Hoeller f26866e4d4 Introduce getType variant with allowFactoryBeanInit flag
Closes gh-23374
2019-09-04 00:06:23 +02:00
Brian Clozel d4089747b8 Use dependency management in Framework build
Prior to this commit, the Spring Framework build would partially use the
dependency management plugin to import and enforce BOMs.

This commit applies the dependency management plugin to all Java
projects and regroups all version management declaration in the root
`build.gradle` file (versions and exclusions).

Some versions are overridden in specific modules for
backwards-compatibility reasons or extended support.

This commit also adds the Gradle versions plugin that checks for
dependency upgrades in artifact repositories and produces a report; you
can use the following:

    ./gradlew dependencyUpdates
2019-09-02 18:01:09 +02:00
Sebastien Deleuze ca02cc1194 Migrate to AssertJ in Kotlin tests
Closes gh-23475
2019-09-02 15:59:26 +02:00
康智冬 a6f4862f13 Fix typos related to indefinite articles
Closes gh-23555
2019-09-01 15:45:49 +02:00
stsypanov 78d56dc61b Use Arrays.copyOf and Arrays.copyOfRange where possible
Closes gh-23393
2019-08-27 19:18:39 +02:00
Sam Brannen 4cd635e9c8 Avoid repeated instantiation of AutowiredArgumentMarker
Prior to this commit, the AutowiredArgumentMarker type was repeatedly
instantiated in ConstructorResolver.

This commit replaces the AutowiredArgumentMarker type with a simple
Object instance.

Closes gh-23469
2019-08-25 22:42:41 +02:00
Sam Brannen ad6231ad29 Add missing @Override annotations 2019-08-23 13:50:58 +02:00
Sam Brannen 0b63db26b7 Reinstate AbstractBeanFactoryTests.typeMismatch() test 2019-08-23 13:50:57 +02:00
Brian Clozel e9523161f0 Revert "Revert "Refactor Gradle tasks in Spring Framework build""
This reverts commit fb0d618751.
2019-08-20 20:26:43 +02:00
Stephane Nicoll fb0d618751 Revert "Refactor Gradle tasks in Spring Framework build"
This reverts commit 1539ba8991.
2019-08-20 20:07:11 +02:00
Brian Clozel 1539ba8991 Refactor Gradle tasks in Spring Framework build
This commit reorganizes tasks and scripts in the build to only apply
them where they're needed. We're considering here 3 "types" of projects
in our build:
* the root project, handling documentation, publishing, etc
* framework modules (a project that's published as a spring artifact)
* internal modules, such as the BOM, our coroutines support and our
integration-tests

With this change, we're strealining the project configuration for all
spring modules and only applying plugins when needed (typically our
kotlin support).

See gh-23282
2019-08-20 18:17:02 +02:00
Sam Brannen 288461a541 Introduce @EnabledForTestGroups in Spring's test suite
Closes gh-23476
2019-08-17 14:47:24 +02:00
Sam Brannen 979508a7f3 Remove JUnit 4 dependency from all modules except spring-test
This commit removes the JUnit 4 dependency from all modules except
spring-test which provides explicit JUnit 4 support.

This commit also includes the following.

- migration from JUnit 4 assertions to JUnit Jupiter assertions in all
  Kotlin tests
- migration from JUnit 4 assumptions in Spring's TestGroup support to
  JUnit Jupiter assumptions, based on org.opentest4j.TestAbortedException
- introduction of a new TestGroups utility class than can be used from
  existing JUnit 4 tests in the spring-test module in order to perform
  assumptions using JUnit 4's Assume class

See gh-23451
2019-08-17 11:37:21 +02:00
Sam Brannen 3f3e41923f Migrate rest of test suite from JUnit 4 to JUnit Jupiter
This commit migrates the rest of Spring's test suite to JUnit Jupiter,
except spring-test which will be migrated in a separate commit.

See gh-23451
2019-08-17 11:36:58 +02:00
Juergen Hoeller 9bd3a535cd Avoid UndeclaredThrowableStrategy with 1.8 bytecode level (CGLIB 3.3)
ClassLoaderAwareUndeclaredThrowableStrategy fails with a VerifyError on recent JDKs after the CGLIB 3.3 upgrade. The alternative is to replace it with a plain ClassLoaderAwareGeneratorStrategy (extracted from CglibSubclassingInstantiationStrategy) and custom UndeclaredThrowableException handling in CglibMethodInvocation.

See gh-23453
2019-08-14 00:14:14 +02:00
Juergen Hoeller 7ac665b18e Polishing 2019-08-01 22:42:33 +02:00
Juergen Hoeller fd86f34057 Merge branch '5.1.x' 2019-08-01 15:27:06 +02:00
Juergen Hoeller 762ea3ea90 Document all remaining public methods on BeanDefinitionParserDelegate
Closes gh-23349
2019-08-01 15:26:11 +02:00
Juergen Hoeller 49593f5399 Revise DependencyDescriptor etc to avoid MethodParameter deprecations
See gh-23385
2019-08-01 14:25:33 +02:00
liym@com fde651a606 Polish getTypeForFactoryBean comment
See gh-23394
2019-08-01 10:17:11 +02:00
Phillip Webb 89d150d398 Resolve factoryBeanClass if necessary
Update `AbstractAutowireCapableBeanFactory.getTypeForFactoryBean` to
use fallback to `determineTargetType` if the factory bean definition
does not have a resolved class.

This is required for the case where a `@Configuration` class is picked
up via component scanning and has a bean type that has not yet been
resolved.

Closes gh-23338
2019-08-01 07:48:12 +01:00
Phillip Webb a6021cc968 Rename SearchStrategy.EXHAUSTIVE to TYPE_HIERARCHY
Rename `SearchStrategy.EXHAUSTIVE` from `MergedAnnotations` to
`SearchStrategy.TYPE_HIERARCHY`

See gh-23378
2019-07-31 13:52:53 +01:00
Juergen Hoeller e6f86c5c75 Nullability refinements and related polishing 2019-07-31 13:45:48 +02:00
Phillip Webb 71a5308c78 Support FactoryBean bean definition attributes
Update `getTypeForFactoryBean` detection so that a bean definition
attribute can be used to supply the result. This commit allows projects
such as Spring Data to provide the result that would be supplied by
`getObjectType` early so that we don't need to initialize the
`FactoryBean` unnecessarily.

Closes gh-23338
2019-07-31 12:22:03 +02:00
Phillip Webb a0e462581f Consider generics for predicting FactoryBean types
Update the `FactoryBean` type prediction logic (primarily in the
`DefaultListableBeanFactory`) so that generic type information is
considered when calling `getBeanNamesForType` on a non-frozen
configuration.

Calling `getBeanNamesForType` with `allowEagerInit` disabled will now
detect `FactoryBean` variants as long as generic type information is
available in either the class or the factory method return type.

Closes gh-23338
2019-07-31 12:22:03 +02:00
Phillip Webb 527876d9a0 Cache AbstractBeanFactory.isFactoryBean results
Add an additional cache to the `RootBeanDefinition` to save
recalculating the result of `isFactoryBean`.

Closes gh-23337
2019-07-31 12:22:03 +02:00
Phillip Webb 95edcb81b5 Retain merged bean definition caches when possible
Update the logic in `AbstractBeanFactory` so that caches from merged
bean definitions remain whenever possible.

Prior to this commit, all merged bean definitions would be completely
removed after bean post processing in case a processor changed the bean
type. It's fairly unlikely these days that the bean type will actually
change, so instead we now compare a subset of the old cached properties
against the newly created definition. Only if key properties have
changed do we now discard the older cached values.

Closes gh-23336
2019-07-31 12:22:03 +02:00
Phillip Webb 2ee1ce61c0 Add missing variants of getBeanNamesForType
Update `ListableBeanFactory` and `BeanFactoryUtils` to add the missing
`getBeanNamesForType` methods that accept a `ResolvableType` rather
than a `Class`.

This completes the work started in 778a01943b.

Closes gh-23335
2019-07-31 12:22:03 +02:00
Juergen Hoeller 8ef557df2f Merge branch '5.1.x' 2019-07-30 17:34:29 +02:00
Juergen Hoeller c4622dbebc Polishing 2019-07-30 16:59:01 +02:00
Juergen Hoeller 8ea3aa512f Merge branch '5.1.x' 2019-07-20 16:35:05 +02:00
Juergen Hoeller 4a09b323b6 Apply getInterfaceMethodIfPossible without SecurityManager as well
Closes gh-23323
2019-07-20 16:11:17 +02:00
Juergen Hoeller daf29118a6 Resolve ApplicationListener against BeanDefinition.getResolvableType()
This covers ApplicationListener generics in factory method return types in particular but also allows for programmatic setTargetType hints.

Closes gh-23178
2019-07-20 15:05:38 +02:00
Sam Brannen 9110a56e11 Merge branch '5.1.x' 2019-07-20 13:33:43 +02:00
zheng.ren01@mljr.com f92b60c08f Only invoke getInterfaceMethodIfPossible() when security manager is used
Prior to this commit, AbstractAutowireCapableBeanFactory's
invokeCustomInitMethod() method invoked
ClassUtils.getInterfaceMethodIfPossible() even if the security manager
was not being used.

This commit ensures that getInterfaceMethodIfPossible() is only invoked
if the security manager is used.

Closes gh-23323
2019-07-20 13:30:57 +02:00
Sebastien Deleuze 095fd5bcb3 Use Kotlin BOM
Close gh-23316
2019-07-19 10:43:54 +02:00
Sam Brannen b774147db4 Polish Javadoc for @Autowired
See gh-23263
2019-07-18 12:07:39 +02:00
Sam Brannen 817f689584 Improve Javadoc for AutowiredAnnotationBeanPostProcessor
See gh-23263
2019-07-18 11:55:18 +02:00
Sam Brannen 56eadff34f Merge branch '5.1.x' 2019-07-17 18:58:08 +02:00
Sam Brannen 74ddf1bee5 Improve documentation for @Autowired constructors
Prior to this commit, there was some ambiguity surrounding semantics
for @Autowired constructors and `required = true`, especially for
multiple @Autowired constructors.

This commit improves the documentation in the Javadoc for @Autowired as
well as in the reference manual.

Closes gh-23263
2019-07-17 18:55:58 +02:00
Rob Winch 8c605dd082 BeanDefinitionParserDelegate uses http://www.springframework.org/schema/
See gh-22839
2019-07-11 18:14:20 +02:00
Сергей Цыпанов 1728bf17fc Avoid unnecessary boxing where primitives can be used
Closes gh-23267
2019-07-10 16:51:18 +02:00
Sam Brannen b8f77e53b5 Polish contribution
See gh-23251
2019-07-10 15:52:41 +02:00
Eric Hettiaratchi 827ec5d5a2 Add unit tests for PropertyAccessorUtils
Closes gh-23251
2019-07-10 15:40:21 +02:00
Sam Brannen 140e1e6532 Polish PropertyAccessorUtilsTests 2019-07-09 17:39:32 +02:00
Sam Brannen fae75cb238 Polish contribution
See gh-23237
2019-07-07 16:29:03 +02:00
Сергей Цыпанов 9f81ffa5ae Use StringJoiner where possible to simplify String joining
Closes gh-23237
2019-07-07 16:19:01 +02:00
Juergen Hoeller a5cb8799fa Merge branch '5.1.x' 2019-07-05 18:22:02 +02:00
Juergen Hoeller 56cc0d02e9 Bean destruction exceptions consistently logged at warn level
Closes gh-23200
2019-07-05 17:07:22 +02:00
Johnny Lim 77aa17fe75 Polish YamlProcessorTests.flattenedMapIsSameAsPropertiesButOrdered()
See gh-23158
2019-06-20 08:34:44 +02:00
Juergen Hoeller 0a77477d32 Merge branch '5.1.x' 2019-06-12 18:16:30 +02:00
Juergen Hoeller fc46abf0b7 Polishing 2019-06-12 18:04:06 +02:00
stsypanov 49873a30c5 Simplify String concatenation 2019-06-12 17:32:35 +02:00
Juergen Hoeller 33b5bc2aae Polishing 2019-06-11 23:50:29 +02:00
Juergen Hoeller a89bfffd8c Merge branch '5.1.x' 2019-06-11 23:16:03 +02:00
Juergen Hoeller 7dc92aa05d Polishing 2019-06-11 20:57:27 +02:00
Juergen Hoeller fd159ad082 Custom init/destroy methods get invoked through interface is possible
Closes gh-22939
2019-06-11 20:56:30 +02:00
Juergen Hoeller 859923b732 Support for fine-grained by-type references and autowired properties
Closes gh-23032
2019-06-11 18:27:46 +02:00
Juergen Hoeller 662541a48e Fix formatting
See gh-23068
2019-06-08 14:26:39 +02:00
陈其苗 ab8e388412 Fix duplicate invoke method of transformedBeanName 2019-06-07 22:48:19 +02:00
Sebastien Deleuze 098ac0bbb8 Annotate Object#equals parameter with @Nullable
Closes gh-23093
2019-06-06 14:18:30 +02:00
Sam Brannen e92ace7301 Merge branch '5.1.x' 2019-06-04 16:22:08 +03:00
Sam Brannen 6eac141160 Restore non-null check for requiredType in BeanFactory methods
Beginning with Spring Framework 5.0, non-null checks for the
requiredType in the following methods were inadvertently removed with
the internal switch to ResolvableType.forRawClass(requiredType).

- BeanFactory.getBean(Class<T>, Object...)
- BeanFactory.getBeanProvider(Class<T>)
- AutowireCapableBeanFactory.resolveNamedBean(Class<T>)

This commit restores those non-null checks.

Closes gh-23045
2019-06-04 16:00:01 +03:00