Commit Graph

745 Commits

Author SHA1 Message Date
Juergen Hoeller ab0d523cc0 Polishing
(cherry picked from commit 1932a9d)
2016-08-17 21:54:40 +02:00
Juergen Hoeller 022b013563 Revised NoSuchBeanDefinitionException message for proper array class names
Issue: SPR-14595
2016-08-17 17:13:28 +02:00
Juergen Hoeller 4b06b60007 RootBeanDefinition accepts ResolvableType for target type hint
Issue: SPR-14580
2016-08-17 16:59:16 +02:00
Juergen Hoeller 214c919742 AspectJ bean pointcut supports qualifier match
Issue: SPR-11217
2016-08-17 00:43:41 +02:00
Juergen Hoeller 1ac8e1c949 Polishing
(cherry picked from commit a4a71a8)
2016-08-11 23:50:54 +02:00
Juergen Hoeller 8b5d3559f5 Avoid stack overflow in case of chained factory-bean references to FactoryBean class
Issue: SPR-14551
2016-08-11 22:56:14 +02:00
Juergen Hoeller 6157fad91f PersistenceAnnotationBeanPostProcessor obtains default EntityManagerFactory via getBean(Class) algorithm
Issue: SPR-7549
2016-08-11 22:42:06 +02:00
Juergen Hoeller d69afaada8 PathEditor tries file system path in case of non-existing resource
Issue: SPR-14549
2016-08-08 13:46:57 +02:00
Juergen Hoeller d128830605 Test injection for @Lookup-declaring bean
Issue: SPR-14550
2016-08-08 13:21:52 +02:00
Juergen Hoeller b9ab895743 Inferred generics for newSetFromMap arrangements
Issue: SPR-13188
2016-07-26 21:26:31 +02:00
Juergen Hoeller e03dea1d64 Polishing 2016-07-26 17:15:19 +02:00
Stephane Nicoll bfa48d551d Polish contribution
Closes gh-1112
2016-07-25 12:34:42 +02:00
fisache 3ccf653174 Polish Javadoc
See gh-1112
2016-07-25 12:30:31 +02:00
Juergen Hoeller 249b798059 Direct reference to JDK 7 AutoCloseable interface
Issue: SPR-13188
2016-07-25 12:06:35 +02:00
Juergen Hoeller ed49ce838e Executable instead of Object for constructor or factory method
Issue: SPR-13188
2016-07-24 15:34:03 +02:00
Juergen Hoeller 4a85309a04 Consistent throwing of BeanNotOfRequiredTypeException even for existing proxy
Issue: SPR-14504
2016-07-24 15:31:00 +02:00
Juergen Hoeller 725fb3219f Polishing 2016-07-20 18:06:31 +02:00
Juergen Hoeller 0e3f0bd9d0 Avoid JDK proxy against CGLIB Factory interface and assert required type when resolving dependency
Issue: SPR-14478
2016-07-20 18:05:51 +02:00
Juergen Hoeller 938b56c0fe BeanWrapperImpl.setBeanInstance correctly exposes root object
Issue: SPR-14474
2016-07-20 18:02:23 +02:00
Juergen Hoeller 99be15f58b Revise encoding steps towards use of JDK Charset and StandardCharsets
Issue: SPR-14492
2016-07-19 23:43:06 +02:00
Juergen Hoeller a4743c07d4 Polishing 2016-07-19 20:09:00 +02:00
Juergen Hoeller aaac199e8b Consistently use constructor-based instantiation instead of Class.newInstance / BeanUtils.instantiate
Issue: SPR-14486
2016-07-19 19:21:06 +02:00
Juergen Hoeller 91ac0bfefa Reinstated support for spring-beans.dtd (streamlined like xsd)
Issue: SPR-13499
2016-07-19 17:46:17 +02:00
Juergen Hoeller c43e7497c1 Fixed typo: "occured"->"occurred" 2016-07-08 15:12:16 +02:00
Juergen Hoeller 23c2b6ad41 Added PathEditor for NIO file system resolution
Issue: SPR-14436
2016-07-08 14:58:38 +02:00
Juergen Hoeller a1f5fb53db Java 8 getParameterCount() instead of getParameterTypes().length
Issue: SPR-13188
2016-07-07 01:04:24 +02:00
Juergen Hoeller 39e3f2ebf6 MethodParameter supports Java 8 Executable/Parameter and validates parameter indexes
Also, equals insists on the same class now, differentiating from SynthesizingMethodParameter.

Issue: SPR-14055
Issue: SPR-13456
Issue: SPR-14438
2016-07-07 00:37:52 +02:00
Juergen Hoeller da9c24c41e Polishing 2016-07-06 18:11:33 +02:00
Juergen Hoeller 5890758fd0 Avoid canonicalName call for already-seen bean name
Issue: SPR-14433
2016-07-06 15:12:18 +02:00
Juergen Hoeller 76dedd7ca2 FactoryBean, BeanPostProcessor and HandlerInterceptor variants declared with default methods
Issue: SPR-14432
2016-07-06 15:10:08 +02:00
Stephane Nicoll e4b0486c5a Add @FunctionalInterface on candidate interfaces
Issue: SPR-14432
2016-07-06 14:32:13 +02:00
Juergen Hoeller bc2c22d51e Streamline XML namespace support towards unversioned schemas
This commit also removes support code for outdated options which were only available in older schema versions.

Issue: SPR-13499
2016-07-05 20:50:03 +02:00
Sam Brannen 2bae0613a3 Ensure code compiles with Eclipse JDT 2016-07-05 19:19:09 +02:00
Sam Brannen 1391248ea6 Introduce log4j 2 for Spring's test suite
This commit adds a test runtime dependency on log4j 2 for every project
and migrates all log4j.properties files to log4j2-test.xml files.

Issue: SPR-14431
2016-07-05 19:19:09 +02:00
Stephane Nicoll 00d2606b00 Explicit type can be replaced by <>
Issue: SPR-13188
2016-07-05 17:00:34 +02:00
Juergen Hoeller b5db5d3aac Broadly remove deprecated core classes and methods
Issue: SPR-14430
2016-07-05 15:52:49 +02:00
Juergen Hoeller 51252ebbca Avoid defensive checks against Java 8 API (java.util.Optional etc)
This commit also fixes broken javadoc links and code references.

Issue: SPR-13188
2016-07-05 02:09:00 +02:00
Juergen Hoeller c4c941c43f Convert comma-separated string into list of classes analogous to existing support for class array
Issue: SPR-14415
2016-06-30 14:02:51 +02:00
Juergen Hoeller e15f7efff8 InjectionPoint propagated for shortcut bean name resolution as well
Issue: SPR-14400
2016-06-26 00:18:54 +02:00
Juergen Hoeller d51c22a789 Consistent processing of empty values and catching of RuntimeExceptions for Formatters
Issue: SPR-14345
2016-06-09 10:49:15 +02:00
Juergen Hoeller 9131ebbea6 Synchronized access to method overrides (in particular for @Lookup)
Issue: SPR-14333
2016-06-06 17:15:56 +02:00
Juergen Hoeller 71463fb399 AbstractBeanFactory consistently guards add/remove operations against alreadyCreated Set
Issue: SPR-14269
2016-05-31 14:12:06 +02:00
Juergen Hoeller 9064d38e4c AbstractBeanFactory.markBeanAsCreated() reliably clears merged bean definition only once
Issue: SPR-14269
2016-05-31 11:05:29 +02:00
Juergen Hoeller cf0a0cd5d8 BeanWrapper avoids StringIndexOutOfBoundsException for incompletely quoted keys
Issue: SPR-14293
2016-05-30 15:15:27 +02:00
Juergen Hoeller 6efa058917 AbstractBeanFactory.markBeanAsCreated() reliably clears merged bean definition first
Issue: SPR-14269
2016-05-29 13:25:16 +02:00
Juergen Hoeller ce2f28da49 CachedIntrospectionResults explicitly introspects implemented interfaces (for Java 8 default methods)
Issue: SPR-14198
2016-04-27 15:39:00 +02:00
Johnny Lim 44e652f99e Remove duplicate words
Closes gh-1039
2016-04-19 08:24:21 +02:00
Juergen Hoeller 7e55b0822f BeanInstantiationException preserves Constructor/Method if available
Issue: SPR-14166
2016-04-14 12:27:47 +02:00
Juergen Hoeller cb9549655c AbstractApplicationContext registers default embedded value resolver
Issue: SPR-14140
2016-04-09 20:49:22 +02:00
Juergen Hoeller 157dcab56c Cleanup of remaining direct BeanWrapper usage
Issue: SPR-14121
2016-04-07 14:27:22 +02:00
Juergen Hoeller 5c1d3fca15 BeanFactory does not unwrap java.util.Optional for top-level bean
Issue: SPR-14121
2016-04-07 14:18:30 +02:00
Juergen Hoeller 4ea4257e3c BeanDefinitionBuilder keeps providing addConstructorArg(Object) for Spring Security 2.x compatibility
Issue: SPR-14123
2016-04-07 11:35:43 +02:00
Juergen Hoeller 4024b2fd4b DefaultListableBeanFactory leniently deserializes into dummy factory if serialization id not resolvable
Issue: SPR-14117
2016-04-05 15:49:30 +02:00
Juergen Hoeller edea66a967 Further tests for getBeanNamesForType(ResolvableType)
Issue: SPR-14097
2016-04-04 14:58:30 +02:00
Juergen Hoeller 852212d0c5 Polishing 2016-03-24 19:57:54 +01:00
Juergen Hoeller 517ebd1d3e Consistent formatting 2016-03-24 19:22:50 +01:00
Juergen Hoeller c5b318a4cc Revised 4.3 signatures for MethodParameter/DependencyDescriptor
Issue: SPR-13440
2016-03-23 18:52:27 +01:00
Sam Brannen 799736c571 Fix typos in Javadoc for AutowireCapableBeanFactory 2016-03-20 15:26:37 +01:00
Juergen Hoeller a905412514 Allow @Autowired to be declared on parameters
Issue: SPR-14057
2016-03-18 22:12:22 +01:00
Juergen Hoeller 431ca9314a Leniently allow constructor argument matches if required name is not resolvable
Issue: SPR-13987
2016-03-18 18:51:33 +01:00
Juergen Hoeller a95bf6e0fc Current InjectionPoint/DependencyDescriptor as factory method argument
Issue: SPR-14033
2016-03-18 15:30:33 +01:00
Juergen Hoeller b944283354 ConstructorResolver exposes parameter signature from user-declared class (in case of a CGLIB-generated subclass)
Issue: SPR-14015
2016-03-11 12:52:40 +01:00
Juergen Hoeller b6f69492a3 NoUniqueBeanDefinitionException exposes beanNamesFound collection
Issue: SPR-13968
2016-03-11 12:49:57 +01:00
Juergen Hoeller 8a83af55b8 Consistent resolution of factory method exceptions
Issue: SPR-13985
2016-02-26 12:31:03 +01:00
Juergen Hoeller b6dd8a9233 Consistent UnsatisfiedDependencyException exposure with injection point metadata
Issue: SPR-13968
2016-02-25 21:36:49 +01:00
Juergen Hoeller ed98393fb2 SmartObjectFactory renamed to ObjectProvider (extends ObjectFactory)
Issue: SPR-13943
Issue: SPR-13956
2016-02-23 14:30:30 +01:00
Stephane Nicoll a94ffbb17a Fix typo 2016-02-22 10:03:27 +01:00
Juergen Hoeller a7ad49adcf Placeholder configurers allow for trimming of property values
Issue: SPR-5839
2016-02-19 19:19:39 +01:00
Juergen Hoeller 890819f886 SmartObjectFactory provides getObject(args) variant as well
Issue: SPR-13956
2016-02-19 14:39:55 +01:00
Juergen Hoeller 48ee9b52d4 Consistent check for Collection/Map beans
Issue: SPR-13963
2016-02-19 02:30:58 +01:00
Juergen Hoeller 1b53edfc5e DefaultListableBeanFactory skips fallback match attempt for Collection/Map beans
Issue: SPR-13963
2016-02-19 00:05:28 +01:00
Juergen Hoeller ea4a766df7 Consistent support for SpEL next to placeholders in annotation attributes
Issue: SPR-13625
2016-02-17 23:00:07 +01:00
Juergen Hoeller 343bb2f130 Support for SmartObjectFactory injection points with programmatic optionality and lenient not-unique handling
Issue: SPR-13943
2016-02-12 17:45:25 +01:00
Juergen Hoeller 903ae48382 DisposableBeanAdapter ignores bridge method conflicts
Issue: SPR-13922
2016-02-08 13:20:48 +01:00
Sam Brannen 81f68463ec Clean up warnings in Gradle build 2016-02-03 18:42:30 +01:00
Sam Brannen 3cf5cfd672 Fix Javadoc 2016-01-28 19:00:37 +01:00
Juergen Hoeller 4a0fa69ce4 Injection support for Collection/Map beans and self references
Issue: SPR-13585
Issue: SPR-12180
Issue: SPR-7915
Issue: SPR-8450
2016-01-25 21:25:48 +01:00
Juergen Hoeller c95dfca726 Log profile-based exclusion of XML bean definition file
Issue: SPR-10202
2016-01-25 20:26:12 +01:00
Stephane Nicoll 0d04af14f8 Refine test
Issue: SPR-13837
2016-01-19 15:11:58 +01:00
Stephane Nicoll 9b9df6a744 Add test
Issue: SPR-13837
2016-01-19 14:40:52 +01:00
Juergen Hoeller 773d175681 Polishing 2016-01-13 12:52:05 +01:00
Juergen Hoeller 04f31816bd Avoid getTypeForFactoryBean warn logging for lazy-init beans
Issue: SPR-13833
2015-12-31 11:47:46 +01:00
Juergen Hoeller 4f955932a7 @Value can be used as aliased meta-annotation
Issue: SPR-13603
2015-12-29 18:02:16 +01:00
Juergen Hoeller 1d8a3e1f07 BeanFactoryAnnotationUtils searches on bean implementation classes and meta-annotations as well
Issue: SPR-13819
Issue: SPR-13452
2015-12-28 23:28:08 +01:00
Juergen Hoeller bb3ff25cad Polishing 2015-12-21 23:07:32 +01:00
Juergen Hoeller b28310d0b9 Polishing 2015-12-21 18:42:49 +01:00
Juergen Hoeller cad2ce0ac2 ConstructorResolver always uses arguments when completely provided
Issue: SPR-13808
2015-12-21 15:11:40 +01:00
Juergen Hoeller fca5365cf1 Avoid scoped destruction callbacks in case of no post-processor actually applying
Issue: SPR-13744
2015-12-18 16:54:05 +01:00
Juergen Hoeller 967ef73765 Detect @Autowired constructors for configuration classes
Issue: SPR-13471
2015-12-18 15:31:31 +01:00
Stephane Nicoll 9e7c791a0f Automatically autowire a bean with one constructor
Previously, if a managed bean had only one non-default constructor, we
should still annotate it with `@Autowired` to properly use constructor
injection. Not doing so resulted in an error as the container was
trying to call the default (non-existing) constructor.

This commit updates this behaviour to automatically applyed the
autowiring semantic to any bean that has only one constructor. As
before, if more than one constructor is defined, `@Autowired` must be
specified to teach the container the constructor it has to use.

Issue: SPR-12278
2015-12-18 14:04:18 +01:00
Sam Brannen 5b3edcd9f9 Spring Cleaning in December
- Delete unused imports
- Delete unused code
- Clean up warnings
2015-12-17 20:27:33 +01:00
Stephane Nicoll 752d3c715a Initiate structure for 4.3 XSDs 2015-12-17 15:43:23 +01:00
Juergen Hoeller 11806b9215 Class identity comparisons wherever possible (and further polishing)
Issue: SPR-12926
2015-12-09 12:28:09 +01:00
Juergen Hoeller 08b6daf1eb Polishing 2015-12-03 18:41:03 +01:00
Juergen Hoeller 7589c1f164 Aligned class name quoting with ConversionFailedException 2015-12-01 16:10:11 +01:00
Juergen Hoeller b70af3bf57 Polishing 2015-12-01 14:10:46 +01:00
Juergen Hoeller 998da2f45c Document destruction callback behavior for inner beans in case of scope mismatch
This commit undoes the previous refinement and rather documents the original behavior.

Issue: SPR-13739
2015-11-30 21:57:54 +01:00
Juergen Hoeller 8ed2c470be Avoid instantiation of non-selected beans in BeanFactoryAnnotationUtils.qualifiedBeanOfType
Issue: SPR-13741
2015-11-30 20:13:03 +01:00
Juergen Hoeller 7104076e19 Avoid Scope.registerDestructionCallback for inner beans in case of scope mismatch
This commit refines getMergedBeanDefinition's scope adaptation algorithm for inner beans, never leaving a custom scope within a containing bean of a different scope. The inner bean's scope will either be aligned with the containing bean's scope (matching the effective state) or be switched to prototype in case of an outer singleton (indicating that no singleton state management is desired).

Issue: SPR-13739
2015-11-30 20:10:26 +01:00
Juergen Hoeller 24e4f56d7e Test case for event listener methods on bean with potentially inactive scope
Also taking the opportunity to refine the "No Scope registered" exception message a bit.

Issue: SPR-13681
2015-11-25 16:56:39 +01:00
Juergen Hoeller 20a286b4d6 ASM ClassWriter uses application ClassLoader for its getCommonSuperClass check
Issue: SPR-13695
2015-11-24 17:38:02 +01:00
Juergen Hoeller 98be36a306 Extended default collection size for common per-bean caches
Issue: SPR-13621
2015-11-13 08:31:00 +01:00
Johnny Lim 2defb6555e Fix broken Javadoc related to `<` and `>` 2015-11-12 11:22:08 +01:00
Juergen Hoeller 2bf8c0bc42 Polishing 2015-11-10 23:47:46 +01:00
Juergen Hoeller 2ba5cb2734 Polishing 2015-11-05 12:30:29 +01:00
Juergen Hoeller e35855f9b5 Avoid expensive annotation retrieval algorithm if no annotations present in the first place
Issue: SPR-13621
2015-11-05 12:26:54 +01:00
Juergen Hoeller 5386e8a9e9 DefaultListableBeanFactory skips resolvableDependencies check for null value
Issue: SPR-13599
2015-10-26 22:45:36 +01:00
Juergen Hoeller 8b3b8d070e Consistently detect spring-beans.dtd reference in last path segment
Issue: SPR-13549
2015-10-09 22:54:35 +02:00
Stephane Nicoll b7c2881a4f Clarify javadoc
The Javadoc wrongly referred to a behaviour that is not (and should not
be) implemented. List items are split into indexed keys and the
comma-separated value is not retained.

Issues: SPR-13257
2015-10-02 14:17:54 +02:00
Sam Brannen d5ee787e1e Migrate JUnit 3 tests to JUnit 4
This commit migrates all remaining tests from JUnit 3 to JUnit 4, with
the exception of Spring's legacy JUnit 3.8 based testing framework that
is still in use in the spring-orm module.

Issue: SPR-13514
2015-09-27 21:17:51 +02:00
Juergen Hoeller 097bcfb997 DefaultListableBeanFactory switches to thread-safe copying for names collections if necessary
Issue: SPR-13493
Issue: SPR-13123
Issue: SPR-12503
2015-09-25 15:20:40 +02:00
Juergen Hoeller 627393a155 Reverted StrictMapAppenderConstructor constructor back to public
Issue: SPR-13504
2015-09-24 22:51:30 +02:00
Juergen Hoeller 54d3d782a9 Polishing 2015-09-23 22:44:52 +02:00
izeye 1aa77ef817 Add a missing `@throws` in Javadoc
Closes gh-873
2015-09-15 06:29:50 -04:00
Juergen Hoeller 667fc7e4a9 Polishing 2015-09-04 14:38:47 +02:00
Juergen Hoeller d4a23b81e9 Properties values get properly converted to generic Map types (fixing 4.x regression without use of ConversionService)
Issue: SPR-13256
2015-08-31 17:20:05 +02:00
Juergen Hoeller ff9fb9aa88 BeanWrapperImpl.getPropertyDescriptor allows for nested paths again
Issue: SPR-13403
2015-08-28 11:17:42 +02:00
Juergen Hoeller 74e6213baf Lookup method definitions can be overridden in child beans
Issue: SPR-13388
2015-08-25 17:08:49 +02:00
Juergen Hoeller b198cad58e SimpleAliasRegistry detects circles between non-canonical aliases as well (through hasAlias)
Additionally, as an optimization, we skip the re-registration step for existing aliases now.

Issue: SPR-13390
2015-08-25 17:06:23 +02:00
Juergen Hoeller 05a16a1bfa Avoid ambiguous property warning for methods with multiple parameters
Issue: SPR-13349
2015-08-21 16:55:04 +02:00
Sam Brannen f47bbb0d9e Polish tests 2015-08-12 19:35:45 +02:00
Juergen Hoeller e0f012f32d Removal of redundant JdkVersion checks in the test suite
Issue: SPR-13312
2015-08-12 18:42:36 +02:00
Juergen Hoeller edd6e76b9f Polishing 2015-07-21 22:58:34 +02:00
Juergen Hoeller 2934256257 Polishing 2015-07-15 00:08:11 +02:00
Juergen Hoeller 09eb492079 Merged bean definitions are now cached early and selectively evicted after post-processing and before actual bean creation
Issue: SPR-12236
2015-07-15 00:05:39 +02:00
Stephane Nicoll de6a649071 Polish 2015-07-09 11:29:48 +02:00
Juergen Hoeller 26acb4887d YamlProcessor explicitly closes UnicodeReader
Issue: SPR-13173
2015-06-29 23:47:37 +02:00
Sam Brannen 6c530b7bfb Delete trailing whitespace in XML files 2015-06-19 17:14:10 +02:00
Sam Brannen 32c17bf540 Revise method and parameter names in annotation support
In AnnotatedElementUtils, all methods pertaining to merging annotation
attributes have been renamed to "getMerged*()" and "findMerged*()"
accordingly. Existing methods such as getAnnotationAttributes(..) have
been deprecated in favor of the more descriptive "merged" variants.
This aligns the naming conventions in AnnotatedElementUtils with those
already present in AnnotationReadingVisitorUtils.

The use of "annotationType" as a variable name for the fully qualified
class name of an annotation type has been replaced with
"annotationName" in order to improve the readability and intent of the
code base.

In MetaAnnotationUtils.AnnotationDescriptor, getMergedAnnotation() has
been renamed to synthesizeAnnotation(), and the method is now
overridden in UntypedAnnotationDescriptor to always throw an
UnsupportedOperationException in order to avoid potential run-time
ClassCastExceptions.

Issue: SPR-11511
2015-06-14 00:34:40 +02:00
Sam Brannen d49bf01c4a Polish Javadoc for AbstractBeanDefinition 2015-06-13 16:08:29 +02:00
Juergen Hoeller 4eea675c15 Stronger warning about lookup methods not working with @Bean
Issue: SPR-13108
2015-06-11 09:58:10 +02:00
Sam Brannen 9afcd17c71 Introduce getAnnotationAttributes(..,Class) in AnnoElUtils 2015-05-29 21:36:00 +02:00
Stephane Nicoll 2dc674f356 Restore AbstractPropertyAccessor
Commit 3d86f15 added a lot of new feature in AbstractPropertyAccessor
shared by both DirectFieldAccessor and BeanWrapperImpl. This makes this
abstract class harder to implement for others having simpler use cases.

It turns that Spring Data has such use case; this commit split these new
features in a dedicated new base class, leaving AbstractPropertyAccessor
untouched.

Issue: SPR-12805
2015-05-22 10:33:28 +02:00
Stephane Nicoll a87d5f8a63 Make PropertyMatches public
Issue: SPR-13054
2015-05-21 20:16:20 +02:00
Stephane Nicoll 6fb3190353 Fix regression with binding and validation
Previously, the binding may have to call the getter first to retrieve the
old value of a property before actually setting it. This was guarded by
a catch block that was accidentally removed in 3d86f15

Restore that catch block and add a test to cover it.

Issue: SPR-12805
2015-05-21 17:48:11 +02:00
Stephane Nicoll 2ab34373d1 Add possible matches for field access
DirectFieldAccessor now support richer NotWritablePropertyException
content, including dedicated error message and possible matches.

Issue: SPR-13053
2015-05-21 15:10:51 +02:00
Stephane Nicoll 3d86f15a84 Merge BeanWrapperImpl and DirectFieldAccessor
`BeanWrapperImpl` and `DirectFieldAccessor` are two
`ConfigurablePropertyAccessor` implementations with different features
set.

This commit harmonizes the two implementations to use a common base class
that delegates the actual property handling to the sub-classes:

* `BeanWrapperImpl`:  `PropertyDescriptor` and introspection utilities
* `DirectFieldAccessor`: reflection on `java.lang.Field`

Issues: SPR-12206 - SPR-12805
2015-05-21 13:49:55 +02:00
Stephane Nicoll 0ed9ca097b Customize destruction callback for AutoCloseable beans
Previously, a Bean implementing `AutoCloseable` (or `Closeable`) was
always destroyed regardless of its bean definition. In particular, the
documented way of disabling the destruction callback via an empty String
did not work.

AutoCloseable beans are now treated pretty much as any other bean: we
still use the presence of the interface to optimize the check of a
destroy method and we only auto-discover the method name to invoke if
the inferred mode is enabled.

Issue: SPR-13022
2015-05-20 17:19:42 +02:00
Juergen Hoeller b4095c3e1d Class identity comparisons wherever possible
Issue: SPR-12926
2015-05-20 14:34:16 +02:00
Juergen Hoeller 6418b54f81 DataBinder tries ConversionService if PropertyEditor could not produce required type
Issue: SPR-13042
2015-05-18 23:53:39 +02:00
Juergen Hoeller e6f99ffe37 Explicit documentation on defaulting for 'autowire' and 'lazy-init'
Issue: SPR-13038
2015-05-18 16:19:45 +02:00
Stephane Nicoll c0269770af Use BeanUtils to instantiate target type
Use BeanUtils.instantiate(Class<?>) instead of a raw call to
type.newInstance() as the former has more checks.

Issue: SPR-12520
2015-05-15 11:43:18 +02:00
Juergen Hoeller 02da2e85ee DataBinder allows for adding custom Formatters as alternative to PropertyEditors (including per-field formatters)
Includes a generic FormatterPropertyEditorAdapter plus Number conversion support in TypeConverterDelegate.

Issue: SPR-7773
Issue: SPR-6069
2015-05-12 22:33:18 +02:00
Juergen Hoeller 549e888cd7 CustomBooleanEditor avoids potential NPE in case of allowEmpty=false
Issue: SPR-13010
2015-05-11 14:20:19 +02:00
Juergen Hoeller 65ba72f1fc FactoryBean type check logs currently-in-creation exception at debug level
Issue: SPR-12900
2015-04-16 18:16:03 +02:00
Sam Brannen 444aa4edcf Polish Javadoc 2015-04-07 22:40:06 -04:00
Juergen Hoeller 595cdf05e9 Polishing 2015-04-04 00:23:25 +02:00
Juergen Hoeller 2c637dcb2e ReaderEditor supports Reader injection analogous to InputStreamEditor (from Spring resource location)
Also, EncodedResource implements InputStreamSource now since it declares getInputStream() anyway.

Issue: SPR-12876
2015-04-01 17:02:55 +02:00
Juergen Hoeller e377fc003d BeanWrapperImpl.setPropertyValue throws InvalidPropertyException with correct property value for nested collection case
Issue: SPR-12866
2015-03-31 10:03:00 +02:00
Juergen Hoeller e7dde740b9 Reduced DefaultListableBeanFactory's override logging to debug level for equivalent bean definition
Issue: SPR-7607
2015-03-25 15:21:58 +01:00
Juergen Hoeller 09027f7972 ResolvableType.forRawClass as a straight wrapper for Class.isAssignableFrom
Issue: SPR-12846
2015-03-24 19:20:15 +01:00
Juergen Hoeller b2308926bc Restored isTypeMatch null behavior and refined typeToMatch parameter name
Issue: SPR-12147
2015-03-23 21:57:03 +01:00
Juergen Hoeller 56273a8ff3 Polishing 2015-03-21 01:19:01 +01:00
Juergen Hoeller 8e4bfa9cc1 BeansDtdResolver resolves spring-beans.dtd declarations to spring-beans-2.0.dtd file
Issue: SPR-12836
2015-03-20 17:41:04 +01:00
Juergen Hoeller 192462902e Consistent support for Java 8 default methods (in interfaces implemented by user classes)
Covers ReflectionUtils.doWithMethods as well as affected annotation post-processors.
Includes an extension of MethodMetadata for the detection of @Bean default methods.

Issue: SPR-12822
Issue: SPR-10919
2015-03-19 16:50:15 +01:00
Juergen Hoeller 778a01943b ResolvableType-based type matching at the BeanFactory API level
Issue: SPR-12147
2015-03-18 23:05:13 +01:00
Juergen Hoeller 768f6e836a Bean class name may contain SpEL expression for late resolution
Issue: SPR-12817
2015-03-16 20:53:41 +01:00
Juergen Hoeller bc6a98c144 Polishing (in particular updating javadoc references to Apache Commons) 2015-03-13 18:19:10 +01:00
Juergen Hoeller 6fe85c2dd4 PropertyResourceConfigurerTests accepts "." in operating system name
Issue: SPR-12794
2015-03-10 14:41:55 +01:00
Sam Brannen d90cee78ef Remove trailing whitespace in source code 2015-03-07 21:16:18 +01:00
Brian Clozel 450072e38a Add spring-mvc spring-beans XSD schemas for 4.2 2015-03-06 17:02:11 +01:00
Juergen Hoeller 9b25d6ad8b getTypeForFactoryBean suppresses instantiation failures for non-singleton FactoryBeans
Issue: SPR-12786
2015-03-06 11:52:27 +01:00
Juergen Hoeller b541fc9366 Polishing 2015-03-05 18:56:57 +01:00
Stephane Nicoll babbf6e871 Harmonize resources location
Issue: SPR-12766
2015-02-28 10:32:40 +01:00
Juergen Hoeller 81102deedf Avoid potential deadlocks between event multicaster and singleton registry through shared lock
Issue: SPR-12739
2015-02-26 18:35:06 +01:00
Sam Brannen 9a1b41ffb8 Polish Javadoc & imports for BeanDefinitionDocumentReaders 2015-02-23 21:35:54 +02:00
Stephane Nicoll 1aec6a6cc2 Detect Order on target class as well
Previously, the `@Order` annotation was managed in an inconsistent way
when placed at the implementation level. For simple beans, it was
discovered properly but wasn't for beans requiring a proxy.

OrderComparator.SourceProvider now explicitly allows to return several
order sources; the default implementation returns not only the factory
method (if  any) but also the target class if it happens to be different
from the class of the bean.

Issue: SPR-12636
2015-02-19 09:47:20 +01:00
Stephane Nicoll aa213396b4 BeanWrapper auto-grows arrays if necessary
Previously, only indexed access for collections were supported. When
attempting to access the element of an array that had not the requested
size, the call would fail with an IndexOutOfBoundException

This commit harmonize the binding support so that the array is updated
according to the requested index if necessary.

Issue: SPR-12706
2015-02-11 11:29:15 +01:00
Juergen Hoeller 918bc3b103 Avoid ConcurrentModificationException in getBeansWithAnnotation
Issue: SPR-12688
2015-02-10 19:24:34 +01:00
Stephane Nicoll d8cec8534e Allow subclasses to configure the Yaml instance
Provide an additional hook-point for YamlProcessor subclasses willing to
change how the Yaml instance is configured. Also expose the default
StrictMapAppenderConstructor so that  they can compose a custom instance
with it.

Issue: SPR-12671
2015-02-02 11:28:54 +01:00
Juergen Hoeller 11bf3b3524 AbstractBeanDefinitionParser allows for skipping evaluation of XML "name" attribute
Issue: SPR-12643
2015-01-20 16:02:01 +01:00
Sam Brannen 60cee7f526 Polish ExtendedBeanInfoTests regarding JDK 8u40 compatibility
This commit simplifies the test for greater clarify and swaps the
'expected' and 'actual' arguments passed to assertEquals().

Issue: SPR-12582
2015-01-02 16:02:04 +01:00
Juergen Hoeller 7492129236 Revised ExtendedBeanInfo test for SPR-8937 (for JDK 8u40 compatibility)
Issue: SPR-12582
2015-01-02 15:18:49 +01:00
Juergen Hoeller 9ac02b319d Remove pre-3.2 deprecated classes and methods
Issue: SPR-12578
2014-12-30 20:05:15 +01:00
Juergen Hoeller bc075c713f Polishing 2014-12-29 20:34:18 +01:00
Juergen Hoeller d55af2b445 Consistent throwing of last UnsatisfiedDependencyException if available and no constructor resolved
Issue: SPR-12543
2014-12-23 17:35:11 +01:00
Juergen Hoeller 809ee0d350 Annotation post-processors clear old InjectionMetadata registrations on refresh
Issue: SPR-12526
2014-12-23 14:02:00 +01:00
Juergen Hoeller dfdfc03ff3 Polishing 2014-12-22 20:02:25 +01:00
Juergen Hoeller 7317457bb1 Consistent bridge method handling in annotation post-processors
Issue: SPR-12495
2014-12-22 18:46:45 +01:00
Stephane Nicoll 6d6cd56d4a Improve logging of registerScope
Issue: SPR-12519
2014-12-22 18:02:26 +01:00
Juergen Hoeller bb1d1e916e Polishing 2014-12-07 20:52:18 +01:00
Juergen Hoeller 03d4e1bc22 Consistent bridge method handling in annotation post-processors
Issue: SPR-12490
Issue: SPR-12495
2014-12-07 20:51:35 +01:00
Juergen Hoeller 15d3b88037 DefaultSingletonBeanRegistry's isDependent defensively checks for circular recursion
Issue: SPR-10787
2014-12-07 16:30:31 +01:00
Phillip Webb 87f1512e88 Add protected YamlProcessor.getFlattenedMap method
Add a protected getFlattenedMap method to the YamlProcessor that
subclasses can use to flatten a source Map so that it has the same
entries as the Properties, but retains order.

Issue: SPR-12499
2014-12-02 17:17:34 -08:00
Juergen Hoeller 82651a07ab BeanFactory accepts getBean arguments for non-prototype beans as well
Issue: SPR-12488
2014-12-01 20:05:11 +01:00
Juergen Hoeller fa0ef2d87e BeanFactory accepts getBean arguments for non-prototype beans as well
Issue: SPR-12488
2014-12-01 19:05:26 +01:00
Juergen Hoeller 9a71a0c6c9 YamlProcessor defensively closes InputStream
Issue: SPR-12487
2014-12-01 16:02:42 +01:00
Juergen Hoeller efb114d49a Polishing 2014-11-29 20:49:21 +01:00
Juergen Hoeller bfbd25a0e9 BeanWrapper auto-growing support for EnumSet / EnumMap
Issue: SPR-12483
2014-11-29 20:49:06 +01:00
Juergen Hoeller e6d7af4ea8 Polishing 2014-11-28 17:36:58 +01:00
Juergen Hoeller eacd4a181f ExtendedBeanInfo ignores invalid bean properties (analogous to the JavaBeans Introspector)
Issue: SPR-12434
2014-11-27 01:41:48 +01:00
Juergen Hoeller feb91e8366 NotReadablePropertyException accepts root cause (analogous to NotWritablePropertyException)
Issue: SPR-12467
2014-11-26 11:52:55 +01:00
Juergen Hoeller afc77ff525 AnnotationBeanPostProcessors defensively catch and translate NoClassDefFoundErrors from class introspection
Issue: SPR-12461
2014-11-22 21:34:59 +01:00
Juergen Hoeller 14fef198f0 Explicitly clear manually registered singleton names after destroySingletons call
As indicated by our recent Spring Integration test failure, autowiring attempts after context closing did not fail before. After the introduction of the separately managed manualSingletonNames set, the algorithm could run into a situation where a singleton name is still in the manualSingletonNames set but not in the singletonObjects map anymore. As a remedy, destroySingletons needs to explicitly clear the manualSingletonNames set in order to remove references to non-disposable singleton beans as well (which are otherwise left in the set since individual destroySingleton calls only come in for disposable beans with destroy methods).

Issue: SPR-12404
2014-11-02 20:15:36 +01:00
Juergen Hoeller 3c3e07e324 Defensive handling of manually registered singleton names (based on Spring Integration test failure)
Issue: SPR-12404
2014-11-01 23:03:02 +01:00
Juergen Hoeller 965bea7b3e DefaultListableBeanFactory efficiently accesses current bean names and exposes them via getBeanNamesIterator()
Issue: SPR-12404
2014-11-01 10:11:20 +01:00
Juergen Hoeller 97ea43681b Polishing 2014-11-01 09:13:34 +01:00
Juergen Hoeller 01382b8ff0 BeanDefinitionValueResolver preserves original String array if possible and resolves nested String arrays as well
Issue: SPR-12391
2014-10-31 17:57:06 +01:00
Juergen Hoeller 7d2231541b Unit tests for java.util.Optional with autowired collections on @Autowired fields/methods and @Bean method parameters
Issue: SPR-9132
2014-10-31 15:28:49 +01:00
Stephane Nicoll 8e5c77dc11 Explicit support of String[] value resolution
This commit adds an explicit support for String array for value
resolution. <util:properties> switches the 'locations' property to a
String array in 662d8aa and this broke expression evaluation.

Issue: SPR-12391
2014-10-31 07:55:27 +01:00
Juergen Hoeller db2601d6e2 AbstractBeanFactory logs bean creation exception on FactoryBean type check at warn level
Issue: SPR-12397
2014-10-30 21:52:54 +01:00
Juergen Hoeller 1e9ab53095 CharacterEditor uses Character.valueOf(char) and throws a more descriptive exception
Issue: SPR-12386
2014-10-28 18:28:15 +01:00
Juergen Hoeller 4945cf1bd1 Optimized parameter length comparisons for constructor/method sorting
Issue: SPR-12385
2014-10-28 13:22:22 +01:00
Juergen Hoeller a13bb69cbe PropertyValue declares its cache fields as transient
Issue: SPR-12377
2014-10-27 15:49:02 +01:00
Juergen Hoeller 9243869763 Test for <util:map> with LinkedCaseInsensitiveMap and specified key/value types
Issue: SPR-10994
2014-10-27 12:08:26 +01:00
Seo, Kyung-Seok 1708a8a10d Remove unnecessary null check
Issue: SPR-12378
2014-10-27 09:32:00 +01:00
Juergen Hoeller 73ce3b514b QualifierAnnotationAutowireCandidateResolver calls BeanFactory.getType defensively
Issue: SPR-12191
2014-10-22 17:04:40 +02:00
Juergen Hoeller ad62b2afb1 Consistent throwing of BeanInstantiationException for factory methods, including a hint about circular references
Issue: SPR-12317
2014-10-21 21:40:43 +02:00
Min Ho Pak 2e5d752e15 Better use of key iterator
This commit uses an EntrySet instead of looping over the keys and
retrieving the value in a separate call.

Issue: SPR-12356
2014-10-21 17:10:39 +02:00
Juergen Hoeller 8325b10080 Consistent formatting of license headers, package javadocs, and import declarations 2014-10-21 01:44:07 +02:00
Juergen Hoeller 77a62ec8b8 Polishing 2014-10-20 17:42:18 +02:00
Stephane Nicoll 859e1e8003 Check for duplicate keys in YAML map nodes
Snake YAML allows for duplicate keys in map nodes. See
https://code.google.com/p/snakeyaml/issues/detail?id=199

This commit uses a dedicated Constructor extension that explicitly
checks for such duplicate keys.

Issue: SPR-12318
2014-10-14 15:58:35 +02:00
Juergen Hoeller 9d832816a8 Further locking optimizations for the retrieval of non-singleton beans
Issue: SPR-12250
2014-10-06 17:42:51 +02:00
Juergen Hoeller f46c706e44 Bean method metadata exposed through AnnotatedBeanDefinition
Issue: SPR-12232
2014-09-26 14:46:09 +02:00
Juergen Hoeller cfc821d179 DataBinder unwraps Optional objects and allows for proper handling of Optional.empty()
Issue: SPR-12241
2014-09-25 17:00:36 +02:00
Juergen Hoeller 070642c148 Introduced addScope convenience method on CustomScopeConfigurer (for use in WebSocket configuration) 2014-09-25 01:31:33 +02:00
Juergen Hoeller 5ecdd8ca31 Consistent Environment access in XML bean definition parsing code
Issue: SPR-12248
2014-09-25 01:02:40 +02:00
Juergen Hoeller 0934751d7a BeanWrapper supports traversal of nested paths with Java 8 Optional declarations
Issue: SPR-12241
2014-09-24 17:56:24 +02:00
Juergen Hoeller a80495b47d Avoid use of fragile Swing classes in tests (for compatibility with JDK 8u40)
Issue: SPR-12235
2014-09-22 17:47:16 +02:00
Juergen Hoeller 354c3e03e9 Refined exclusion of bridge methods in annotation post-processors (for Java 8 compatibility)
Issue: SPR-12187
(cherry picked from commit 29abca5)
2014-09-19 00:52:44 +02:00
Juergen Hoeller f4219ca06b Consistent exclusion of bridge methods in annotation post-processors (for Java 8 compatibility)
Issue: SPR-12187
2014-09-18 23:45:42 +02:00
Juergen Hoeller 0cf472b111 BeanDefinitionParserDelegate does not silently ignore 1.x 'singleton' attribute
Issue: SPR-12167
2014-09-17 13:26:37 +02:00
Juergen Hoeller 80cec011b7 Log warning for single optional constructor when no default constructor to fall back to
Issue: SPR-12161
2014-09-17 13:02:11 +02:00
Juergen Hoeller d1c720c07b GenericTypeAwarePropertyDescriptor implements equals/hashCode for proper lookups on IBM JVM 6
Issue: SPR-12185
2014-09-17 00:03:30 +02:00
Juergen Hoeller 5cd59d044e GenericTypeAwarePropertyDescriptor implements equals/hashCode for proper lookups on IBM JVM 6
Issue: SPR-12185
2014-09-16 23:40:10 +02:00
Juergen Hoeller 7387475deb Polishing 2014-09-12 23:49:14 +02:00
Juergen Hoeller c52484ed68 CachedIntrospectionResults uses ConcurrentReferenceHashMap for its type descriptor cache
Issue: SPR-12185
2014-09-12 19:47:52 +02:00
Juergen Hoeller c8bbd0bae4 Polishing 2014-09-07 22:51:21 +02:00
Juergen Hoeller 20c2ba35dc Polishing 2014-09-04 00:55:38 +02:00
Juergen Hoeller c6d29f1a31 Refactored support for @Order on @Bean methods as well as @Priority handling
Issue: SPR-11310
Issue: SPR-10548
2014-09-04 00:41:13 +02:00
Juergen Hoeller 4432c41dbd AbstractAutowireCapableBeanFactory avoids early FactoryBean instantiation on currently created configuration bean
Issue: SPR-12141
2014-09-03 00:28:05 +02:00
Juergen Hoeller cfd01ab100 ExtendedBeanInfo uses explicit hashCode calculation (as defensive measure against JDK PropertyDescriptor changes) 2014-09-02 22:15:33 +02:00
Juergen Hoeller 8c9274e017 LazyInitTargetSource works for @Bean targets as well
Issue: SPR-10508
Issue: SPR-8080
2014-09-02 22:13:35 +02:00
Juergen Hoeller b64f680f19 AbstractAutowireCapableBeanFactory calls postProcessBeforeInstantiation with fully resolved target type
Issue: SPR-12140
Issue: SPR-12142
2014-09-02 22:10:09 +02:00
Juergen Hoeller 60e58a2012 Polishing 2014-08-21 14:29:14 +02:00
Juergen Hoeller 8eac87064d AbstractAutowireCapableBeanFactory avoids synchronization in filterPropertyDescriptorsForDependencyCheck
Issue: SPR-12106
2014-08-21 14:26:17 +02:00
Juergen Hoeller 662d8aa9f1 util:properties supports multiple resource locations and ignore-resource-not-found
Issue: SPR-10614
2014-08-20 16:31:54 +02:00
Juergen Hoeller e48c315ad1 DefaultSingletonBeanRegistry performs non-synchronized checks for existing entries in dependentBeanMap and containedBeanMap
Also adding alias resolution to isDependent's algorithm (for circular dependency detection).

Issue: SPR-8834
Issue: SPR-7966
2014-08-20 12:02:16 +02:00
Juergen Hoeller 9d3d6d5919 DefaultListableBeanFactory defensively handles BeanDefinition access in getBean(Class)
Issue: SPR-10542
2014-08-20 10:48:35 +02:00
Juergen Hoeller af6ef5f74c Use ConcurrentMap declarations when calling putIfAbsent (for compatibility with JDK 6 and 7)
Issue: SPR-12102
2014-08-19 23:28:42 +02:00
Juergen Hoeller 781a6d289e CachedIntrospectionResults uses putIfAbsent where possible (for minimal write locking)
Issue: SPR-12102
2014-08-19 22:50:54 +02:00
Juergen Hoeller b3add794d7 Polishing 2014-08-15 00:55:40 +02:00
Juergen Hoeller 69587f3fa4 Polishing 2014-08-14 23:49:29 +02:00
Juergen Hoeller eb0ab8431b Lookup methods can support arguments, find a target bean based on the return type, and be identified by an @Lookup annotation
Issue: SPR-7431
Issue: SPR-5192
2014-08-14 23:49:05 +02:00
Juergen Hoeller fd5dbddac4 BeanFactory supports bean creation arguments for by-type lookup as well
Issue: SPR-11235
2014-08-12 22:07:12 +02:00
Juergen Hoeller ad475ffadf Consistent vararg declarations for String array setters 2014-08-08 17:17:09 +02:00
Stephane Nicoll 3da68cfe21 Remove unused imports 2014-08-04 14:13:40 +02:00
Juergen Hoeller fe05e7e5b3 Self reference detection defensively handles null bean names
Issue: SPR-12018
2014-07-24 12:56:10 +02:00
Juergen Hoeller 496492b2d8 Autowiring rejects self references to a factory method on the same bean as well
Issue: SPR-12018
2014-07-24 12:13:25 +02:00
Stephane Nicoll e849bc3e90 Fix potential NPE
This commit fixes a potential NPE when determining the priority of a
bean instance in case multiple candidates exist and no bean was marked
as @Primary

Issue: SPR-12024
2014-07-23 18:51:09 +02:00