Commit Graph

1530 Commits

Author SHA1 Message Date
Sebastien Deleuze 068565172e Add a BeanFactory#getBeanProvider Kotlin extension
Issue: SPR-17274
2018-09-13 16:53:28 +02:00
Juergen Hoeller b6d32ef55f Bean definition DSL generates unique bean names for bean classes
Issue: SPR-17242
2018-09-12 14:59:10 +02:00
Juergen Hoeller dcac30c41c Upgrade to Tomcat 9.0.12 and SnakeYAML 1.23 2018-09-11 14:57:31 +02:00
stsypanov 7dba79c7c1 Use String::isEmpty instead of "".equals(arg) when arg is not null 2018-08-26 22:48:21 +02:00
Juergen Hoeller 9614817e88 Do not proxy test instances based on "original instance" convention
Issue: SPR-17137
2018-08-24 00:49:01 +02:00
Sam Brannen 2bb15f7ed2 Fix grammar in JavaDoc for fully qualified links
This commit represents a best effort attempt at fixing remaining
"a" vs. "an" grammatical errors related links specified via a fully
qualified class name.

Issue: SPR-17208
2018-08-23 17:59:44 +02:00
Juergen Hoeller f13f041fae Consistent trace logging for init and destroy methods
Issue: SPR-17090
2018-08-22 14:13:12 +02:00
Juergen Hoeller 04d2d1da0d Consistently use double quotes (even if no interpolation needed)
Includes upgrade to Hibernate ORM 5.3.5, EclipseLink 2.7.3, Selenium HtmlUnit Driver 2.32.1, Jetty 9.4.12 RC2.
2018-08-16 15:32:44 +02:00
Juergen Hoeller 5d7fb1a1c2 Polishing 2018-08-16 12:08:26 +02:00
Juergen Hoeller 109a2b49e5 Consistently skip unnecessary search on superclasses and empty elements
Includes caching of declared annotation arrays and combined searching for several annotation types (used in SpringCacheAnnotationParser).

Issue: SPR-16933
2018-08-15 17:30:14 +02:00
Juergen Hoeller 999c7809a7 Refined warn/info logging in AutowiredAnnotationBeanPostProcessor
Issue: SPR-16946
2018-08-13 12:43:52 +02:00
Juergen Hoeller 347852e86a Avoid argument resolution overhead for no-arg factory methods
Includes revised InstantiationStrategy nullability for args array.

Issue: SPR-17171
2018-08-13 12:43:41 +02:00
Juergen Hoeller fc16b2d3fb AbstractHandlerMethodMapping allows for customized bean retrieval
Issue: SPR-15535
2018-08-11 01:20:17 +02:00
Juergen Hoeller aebb2d52e0 Logging refinements for transaction and cache processing (debug/trace)
Issue: SPR-16946
2018-08-10 15:45:46 +02:00
Juergen Hoeller def6fbba89 ListableBeanFactory.getBeansWithAnnotation does not include null beans
Issue: SPR-17034
2018-08-10 15:45:37 +02:00
Juergen Hoeller eddbf13d5d BeanFactoryUtils caches transformedBeanName results for factory beans
Issue: SPR-17151
2018-08-09 16:06:05 +02:00
Kazuhiro Sera be211ceead Fix typos detected by github.com/client9/misspell 2018-08-08 12:50:46 +02:00
Juergen Hoeller f155d21c95 DisposableBean javadoc refers to singletons as well as scoped beans
Issue: SPR-17131
2018-08-06 19:46:41 +02:00
Juergen Hoeller 28565e25fa Javadoc references for resetBeanDefinition
Issue: SPR-17126
2018-08-06 19:45:06 +02:00
Juergen Hoeller e64c6dfa3d MergedBeanDefinitionPostProcessors clear internal caches on bean reset
Issue: SPR-17126
2018-08-06 15:41:35 +02:00
Juergen Hoeller dc36bb34c7 Polishing 2018-08-02 14:41:27 +02:00
Juergen Hoeller 4a147d26fc Initialize pre-filled HashMaps with large enough capacity
Empty Maps are preferably initialized without capacity (not initializing them at all or lazily initializing with default capacity when needed).

Issue: SPR-17105
2018-07-30 22:07:31 +02:00
Juergen Hoeller 109552d868 Polishing 2018-07-27 18:58:18 +02:00
Juergen Hoeller 1fd6248d84 Polishing 2018-07-27 17:46:21 +02:00
Juergen Hoeller c037e75f26 Improve debug logging at BeanDefinitionReader and BeanFactory level
Issue: SPR-17090
2018-07-27 17:46:05 +02:00
Hannes Metssalu 142530874b Fixed a typo in documentation.
'AbstractFactoryBean#getEarlySingletonInstance' documentation mentions "eager singleton". I'm quite sure it should be fixed to "early singleton".
2018-07-26 13:48:38 +02:00
Juergen Hoeller c2a5fcd353 Fallback to empty collection/map only if actually no target bean found
Issue: SPR-15338
2018-07-26 05:59:18 +02:00
Juergen Hoeller a9c9ba6601 Generic matching for ObjectProvider stream and empty vararg resolution
Issue: SPR-11419
Issue: SPR-15338
2018-07-24 13:03:54 +02:00
Juergen Hoeller 5f51e86185 Avoid relying on runtime constructor order for argument conversion 2018-07-24 01:04:47 +02:00
Juergen Hoeller 1603c4ab2f Programmatic ObjectProvider retrieval through BeanFactory API
Introduces getBeanProvider(Class) and getBeanProvider(ResolvableType), also narrowing getBean(String, Class) and isTypeMatch(String, Class) to a non-null Class argument and enriching NoUniqueBeanDefinitionException with a full ResolvableType. In addition, ObjectProvider supports iterable/stream access for collection-style resolution of multiple matching beans now, and collection injection falls back to an empty collection in a single-constructor case with non-null arguments.

Issue: SPR-17075
Issue: SPR-11419
Issue: SPR-15338
2018-07-24 00:42:03 +02:00
Sebastien Deleuze f8f8d28f08 Support running Kotlin apps without kotlin-reflect
This commit includes an optimization of BeansUtils#instantiateClass
that favors Java reflection for default constructors before leveraging
Kotlin one for finding primary constructors and avoids Kotlin related
conditions when running in Java.

Issue: SPR-17069
2018-07-23 09:54:48 +02:00
Juergen Hoeller f58854f4b9 Locally cache factory method candidates per factory class
Issue: SPR-17071
2018-07-22 19:22:20 +02:00
Juergen Hoeller 13873dafb7 Polishing 2018-07-22 17:55:31 +02:00
Juergen Hoeller cfbacfd89b Revise ResolvableType.as for introspection performance
This revision limits serializability of derived interfaces, superclasses and type parameters, optimizing for introspection performance instead.

Issue: SPR-17070
2018-07-22 17:49:53 +02:00
stsypanov 5051850fa9 SPR-17074 Replace iteration over Map::ketSet with Map::entrySet 2018-07-21 13:12:43 +02:00
Juergen Hoeller 9a43d2ec20 Revised log levels: less WARN and INFO, fine-tuned DEBUG vs TRACE
Issue: SPR-16946
2018-07-20 15:05:16 +02:00
Juergen Hoeller 09920d9b01 Raise testPrototypeCreationWithPropertiesIsFastEnough limit to 4000 ms 2018-07-19 17:51:54 +02:00
Juergen Hoeller 52d124de6f Use supplier-aligned type information for FactoryBean type resolution
Issue: SPR-17063
2018-07-19 13:14:20 +02:00
Juergen Hoeller 9c08a482d1 Prefer ArrayList/ArrayDeque over LinkedList for multi-element holders
LinkedList remains in place where a List is likely to remain empty or single-element (in order to avoid unused capacity).

Issue: SPR-17037
2018-07-18 22:17:42 +02:00
Juergen Hoeller 28f7b26294 Null-returning instance supplier resolves to NullBean
Issue: SPR-17057
2018-07-18 15:26:06 +02:00
Juergen Hoeller 77d72f1e01 Injected Map/Collection does not include null bean entries
Issue: SPR-17034
2018-07-16 13:04:38 +02:00
Juergen Hoeller 680afa75d8 ListableBeanFactory.getBeansOfType does not include null bean entries
Issue: SPR-17034
2018-07-14 01:02:39 +02:00
Juergen Hoeller 3a4b5c2ade RootBeanDefinition publicly exposes target type as ResolvableType
Issue: SPR-17028
2018-07-10 19:28:12 +02:00
Juergen Hoeller 2cd006923c Polishing 2018-07-06 14:38:29 +02:00
Juergen Hoeller b4fc7943e1 Make javax.inject.Provider impl invisible for nested class introspection
Issue: SPR-17014
2018-07-06 13:20:03 +02:00
Juergen Hoeller d8c7270c00 Consistent Iterator/Stream support in PropertySources and PropertyValues
Issue: SPR-16894
2018-07-05 23:59:56 +02:00
Juergen Hoeller 182243d20d BeanDefinitionOverrideException in case of overriding not allowed
Issue: SPR-16982
2018-07-04 21:32:51 +02:00
Juergen Hoeller 63d6215247 Polishing 2018-07-04 19:23:27 +02:00
Juergen Hoeller 2fe3c36cc2 Polishing 2018-07-03 17:54:43 +02:00
Juergen Hoeller f2787cfb35 Same method filtering in ConstructorResolver and getTypeForFactoryMethod
Issue: SPR-16999
2018-07-03 15:53:17 +02:00
Juergen Hoeller e5a6711d29 Consistent final declaration for static delegate classes
Issue: SPR-16968
2018-07-02 13:55:18 +02:00
Juergen Hoeller 4ff1e3e74b Consistent abstract declaration for utility classes (plus polishing)
Issue: SPR-16968
2018-07-01 02:31:20 +02:00
Juergen Hoeller d34e6f7f70 Polishing 2018-06-28 18:02:07 +02:00
Juergen Hoeller 8ad5299f4a Polishing 2018-06-28 17:12:29 +02:00
Juergen Hoeller 40efcc933c Polishing 2018-06-28 14:51:33 +02:00
Juergen Hoeller bf5fe46fa9 CachedIntrospectionResults completely traverses interface hierarchy
Issue: SPR-16978
2018-06-28 14:15:16 +02:00
Juergen Hoeller 81cb740e0a New postProcessProperties variant on InstantiationAwareBeanPostProcessor
Allows for skipping the now-deprecated postProcessPropertyValues callback with its expensive PropertyDescriptor retrieval requirement. RequiredAnnotationBeanPostProcessor (which is dependent on postProcessPropertyValues) and the @Required annotation itself are also deprecated now: in favor of constructor injection (or afterPropertiesSet).

Issue: SPR-16918
2018-06-28 14:15:16 +02:00
Phillip Webb a89e716cc7 Use tabs rather than spaces in tests
Update tests to ensure that tabs are used instead of spaces. Also
consistently apply a new line at the end of each file.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb 5cedd0d5d4 Consistently use tabs rather than spaces
Update code that has accidentally used spaces instead of tabs.
Also remove all trailing whitespace.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb 634f5c2792 Ensure when equals() is implemented so is hashCode()
Update classes that override `equals()` to ensure that they also
implement `hashCode()`.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb 9de3689f63 Never use 'this.' when accessing loggers
Ensure that `this.` is never used when accessing loggers.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb 0b53c1096a Always use 'this.' when accessing fields
Ensure that `this.` is used consistently when accessing class
fields.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb eeebd51f57 Use consistent class design
Update all classes so that inner classes are always last. Also
ensure that utility classes are always final and have a private
constructor and make exceptions final whenever possible.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb 8f9aa06dfe Polishing AbstractBeanDefinition.equals 2018-06-28 10:28:44 +02:00
Phillip Webb 866e9d702e Use consistent block style
Update all code to use a consistent block style.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb 04a8c285df Fix annotation styling issues
Update all annotations so that each is on its own line and
consistently use the short form (i.e. don't use `value=`) when
possible.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb e0480f75ac Fix javadoc checkstyle issues
Fix checkstyle violations for javadoc.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Sam Brannen cafb5033e2 Polishing 2018-06-19 13:50:13 +03:00
Juergen Hoeller 51091f2242 Suppress deprecation warning in DefaultBeanDefinitionDocumentReader
Issue: SPR-12458
2018-06-15 22:09:23 +02:00
Juergen Hoeller 0777a80efe Polishing
(cherry picked from commit a2765c0)
2018-06-11 19:17:57 +02:00
Brian Clozel 0092653d42 Fix JDK9 build after Groovy 2.5 upgrade
After the Groovy 2.5 upgrade, the Spring Framework build on JDK9 hit
GROOVY-8631. Adding the relevant `jax-api` dependency to the module
didn't fix this issue. The Groovy release notes mention the use of the
`--add-modules` JVM flag, but this is not an option for this build which
should run on JDK8 -> JDK11.

This commit changes the dependency from `groovy-all` to more focused
dependencies on Groovy in the `spring-beans` and `spring-context`
modules. This change seems to avoid the automatic loading of Groovy
enhancements to JAXB (shipped with `groovy-xml`).

See:

* http://groovy-lang.org/releasenotes/groovy-2.5.html#Groovy2.5releasenotes-Knownissues
* https://issues.apache.org/jira/browse/GROOVY-8631

Issue: SPR-15407
2018-06-08 13:37:44 +02:00
Juergen Hoeller 7ece0e219e Correct code example for YamlProcessor.setDocumentMatchers
Issue: SPR-16849
2018-06-06 21:27:00 +02:00
Juergen Hoeller 74fcdea2d9 SimpleAliasRegistry logs info message for alias overriding
Issue: SPR-16871
2018-05-29 21:51:33 +02:00
Juergen Hoeller 46a89d9534 Restore lenient null return value for ConditionContext.getBeanFactory()
Includes nullable return value for getClassLoader() with corresponding notes in applicable javadoc.

Issue: SPR-16866
2018-05-29 21:51:06 +02:00
Juergen Hoeller 138b0d0bbd YamlProcessor embraces SnakeYAML 1.18+ duplicate key handling
Includes removal of StrictMapAppenderConstructor for compatibility with SnakeYAML 1.21.

Issue: SPR-16791
2018-05-05 12:47:11 +02:00
Juergen Hoeller 9281f820f1 Expose FactoryBean's raw object on retrieval during post-processing
Issue: SPR-16783
2018-05-02 15:21:40 +02:00
Stephane Nicoll e51330e905 Keep YAML entries that haven an empty array value
Prior to this commit, a YAML entry that define an empty array value was
lost. This commit makes sure to flag it with an empty String, which
corresponds as an empty comma separated list of entries in the
properties format.

Issue: SPR-16769
2018-04-29 10:30:08 +02:00
Dimitrios (Dimi) Liapis 6d6da91ab9 Fix typo
See gh-1803
2018-04-21 18:16:13 +02:00
Juergen Hoeller b95e05db04 AspectJExpressionPointcut consistently resolves superinterface methods
Includes efficient check for same ClassLoader in ClassUtils.isVisible, efficient MethodMatchers check for IntroductionAwareMethodMatcher, and supertype method resolution in MethodMapTransactionAttributeSource.

Issue: SPR-16723
2018-04-14 15:10:05 +02:00
Juergen Hoeller 6184c4ecc9 Consistent getTypeForFactoryMethod result for parameterized method
Issue: SPR-16720
2018-04-12 15:14:41 +02:00
Juergen Hoeller 61c3db0869 MethodHandles.Lookup.defineClass for CGLIB class definition purposes
Spring's CGLIB fork is patched with local copies of affected files here, introducing the notion of a "contextClass" (e.g. the proxy superclass) which gets passed through to ReflectUtils.defineClass for delegating to MethodHandles.Lookup.defineClass eventually, against a privateLookupIn(contextClass) lookup context on JDK 9/10/11.

Issue: SPR-15859
2018-04-11 12:47:55 +02:00
Thor Andreas Rognan 17c16eaa9e Upgrade to Gradle 4.6
Issue: SPR-16475
2018-04-04 12:39:09 +02:00
Bian Jiaping 8f525f07e9 Fix typos, formatting and escaping in reference
Note: Some symbol combinations (including <=) serve as textual symbol
replacements in AsciiDoc.

http://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#text-replacement
2018-03-30 10:06:33 -04:00
Juergen Hoeller d553ddc5b3 Nullability refinements (based on IntelliJ IDEA 2018.1 introspection)
Issue: SPR-15756
2018-03-29 23:50:17 +02:00
igor-suhorukov 93abe0e94b All branches in a conditional structure should not have exactly the same implementation 2018-03-29 23:33:50 +02:00
Juergen Hoeller e3d0ef6015 Use Map.forEach instead of manual Map.Entry iteration wherever possible
Issue: SPR-16646
2018-03-27 00:38:32 +02:00
Juergen Hoeller 24aae2e104 Defensive containsSingleton cache guard within getObjectFromFactoryBean
Issue: SPR-16625
2018-03-27 00:24:03 +02:00
Juergen Hoeller 8d5587fe4f Consistent thread-safe iteration in DefaultSingletonBeanRegistry
Issue: SPR-16620
2018-03-24 16:30:51 +01:00
Juergen Hoeller 8d8e218b52 Consistent FactoryBean cache visibility in concurrent creation scenarios
Issue: SPR-16625
Issue: SPR-16627
2018-03-23 17:34:33 +01:00
Juergen Hoeller 937cd48fcb Contextual BeanCreationException in case of depending on a missing bean
Issue: SPR-16628
2018-03-23 17:32:08 +01:00
Christoph Dreis d3a0a8e007 Use Collection.removeIf() where possible (#1747)
Use Collection.removeIf() where possible

Issue: SPR-16622
2018-03-22 11:36:11 +01:00
Juergen Hoeller 499128dae7 URIEditor uses straight ClassPathResource.getURI() access
Issue: SPR-16581
2018-03-12 22:26:18 +01:00
igor-suhorukov 32b689a994 use StringBuilder for complex string concatenation 2018-03-08 21:25:47 +01:00
Juergen Hoeller 139dc1d373 Polishing (collapsed if checks, consistent downcasts, refined javadoc) 2018-03-08 18:11:57 +01:00
igor-suhorukov 0f7485b01d Polish: reorder the modifiers to comply with the Java Language Specification. 2018-03-08 17:57:47 +01:00
Juergen Hoeller a02aafe5fe Regular getBeanInfo call for interfaces (enabling Introspector's cache)
Issue: SPR-16568
2018-03-08 12:29:09 +01:00
Juergen Hoeller f57fcdee3c Polishing 2018-03-07 15:49:58 +01:00
Juergen Hoeller 4f8c4546f1 Upgrade to SnakeYAML 1.20 and Selenium 3.10 2018-03-05 15:25:01 +01:00
igor-suhorukov 129530f792 Polish
Closes gh-1715
2018-03-03 12:12:15 +01:00
Juergen Hoeller bfddbbe731 Polishing 2018-03-01 01:39:06 +01:00
Juergen Hoeller 6f7ad0304c Polishing 2018-03-01 00:29:38 +01:00
igor-suhorukov 8080f56db8 Polish: "@Override" should be used on overriding and implementing methods 2018-03-01 00:15:18 +01:00
Juergen Hoeller a19d4deb24 Polishing 2018-02-28 16:41:59 +01:00
Juergen Hoeller 9962df6527 Polishing 2018-02-28 00:09:15 +01:00
igor-suhorukov d1ccecd021 Polish: to get rid unnecessary array creation 2018-02-27 23:37:54 +01:00
igor-suhorukov 7bce04c06c Polish: combine catches block with same body 2018-02-27 12:51:28 +01:00
igor-suhorukov b202205d77 Polish: String.valueOf() should not be appended to a String 2018-02-25 21:10:19 +01:00
igor-suhorukov 49fd724d8f Polish: String function use should be optimized for single characters 2018-02-25 20:48:47 +01:00
igor-suhorukov c782075a13 Polish: Array designators "[]" should be on the type, not the variable 2018-02-25 13:14:20 +01:00
Juergen Hoeller 7f58d9ede0 Efficiently merge bean name result with parent result (possibly empty) 2018-02-25 00:27:06 +01:00
igor-suhorukov 67a91cf6f9 Polish: redundant pairs of parentheses should be removed 2018-02-25 00:01:43 +01:00
Juergen Hoeller a5cbf5fe24 Consistent use of Collection.toArray with zero-sized array argument
Includes consistent use of ClassUtils.toClassArray (as non-null variant)

Issue: SPR-16523
2018-02-22 11:29:46 +01:00
Juergen Hoeller d7cab23e6d Consistent use of StringUtils.toStringArray
(cherry picked from commit 6d11b40)
2018-02-16 20:49:17 +01:00
Juergen Hoeller c9d08bff41 DefaultListableBeanFactory only calls getPriority for non-null instance
Issue: SPR-16508
2018-02-16 17:27:42 +01:00
Juergen Hoeller 8d3264f680 Prefer List.sort(Comparator) over Collections.sort(List, Comparator) 2018-02-16 10:23:18 +01:00
igor-suhorukov 2be4985b8f Polish: anonymous inner classes containing only one method should become lambdas,
use getOrDefault instead of ternary operator
2018-02-16 09:38:19 +01:00
Juergen Hoeller 3b810f3544 Consistent Class array vs vararg declarations (and related polishing) 2018-02-14 14:44:00 +01:00
Juergen Hoeller d5cabca2f7 Internal adaptation to Deque semantics 2018-02-12 15:55:09 +01:00
igor-suhorukov 711b0f50f2 Polish: replace the synchronized class "Stack" by an unsynchronized one such as "Deque". 2018-02-11 21:15:46 +01:00
igor-suhorukov 0ee505b73e Polish: assertion arguments should be passed in the correct order,
use assertNull instead of assertEquals(null, value),
declare delta as double value in assertEquals
2018-02-10 17:17:28 +01:00
igor-suhorukov 6ea0af3540 Polish: Lambdas should be replaced with method references 2018-02-10 12:09:46 +01:00
igor-suhorukov 9a6fbf59c5 Polish: follow name convention - make immutable fields final 2018-02-10 12:09:19 +01:00
Stephane Nicoll 991eb4858e Update copyright header 2018-02-09 10:16:58 +01:00
igor-suhorukov c0b4b5787f Change this "try" to a try-with-resources
Closes gh-1671
2018-02-09 10:12:55 +01:00
Juergen Hoeller 285b01fc79 Test with all-negated profile condition
Issue: SPR-16465
2018-02-07 14:14:11 +01:00
Juergen Hoeller 5c813a366b Consistent use of @throws instead of @exception 2018-02-05 22:51:51 +01:00
Kamil Szymanski 61117245a6 Replace manual array copy with native method call
Closes gh-1606
2018-02-04 11:39:43 +01:00
Juergen Hoeller 4a1cc9ced7 Constructor-provided field values get recorded for failed binding result
Also, TypeMismatchExceptions get registered via BindingErrorProcessor.

Issue: SPR-16449
2018-02-02 11:33:56 +01:00
Juergen Hoeller 7772b914c6 Deep BeanCurrentlyInCreationException check in getTypeForFactoryBean
Issue: SPR-16427
2018-01-29 21:13:59 +01:00
Juergen Hoeller ea5f8f5a7c Consistently handle NoClassDefFoundError in BeanUtils and related places
Issue: SPR-16369
2018-01-17 20:24:57 +01:00
Juergen Hoeller 214576673a Proper NoClassDefFoundError check against BeanUtils.instantiateClass
Issue: SPR-16369
2018-01-17 18:29:05 +01:00
sdeleuze 19a1477228 Fix Kotlin bean w/ default + secondary ctors handling
This commit polishes SPR-16022 fix in order to handle correctly
the case when primary and default constructors are the same when
a secondary constructor is defined.

Issue: SPR-16289
2018-01-10 18:29:33 +01:00
Juergen Hoeller 45828cb934 Check BeanInfoFactory for interface introspection as well
Issue: SPR-16322
2018-01-08 18:05:02 +01:00
Juergen Hoeller 4adc820714 Warning instead of error for non-present type filter class
Issue: SPR-16356
2018-01-08 13:41:23 +01:00
Juergen Hoeller 4a57e26d76 Polishing 2018-01-07 23:33:35 +01:00
Juergen Hoeller 18d90ec140 Properly handle null FactoryBean instance
Issue: SPR-16250
2018-01-07 23:22:56 +01:00
Juergen Hoeller d3e0f4dd91 Consider enum subclasses as simple value types as well
Issue: SPR-16278
2018-01-07 23:20:09 +01:00
Juergen Hoeller 9beb97880f Support for static field access on non-public enums
Issue: SPR-16284
2018-01-07 23:19:47 +01:00
Christoph Dreis 260ebeca3a Improve performance of some string operations
Issue: SPR-16293
2017-12-12 17:14:24 +01:00
sdeleuze 9f1d8517ba Polish Kotlin source code style 2017-11-21 15:59:23 +01:00
Juergen Hoeller 84699c8b9b Document common use cases for @Order vs @Priority vs @DependsOn
Issue: SPR-16213
2017-11-20 12:53:37 +01:00
Juergen Hoeller 7697b398d5 Polishing 2017-11-14 17:11:16 +01:00
sdeleuze edf8232555 Avoid implicit autowiring with Kotlin secondary ctors
Autowiring implicitely Kotlin primary constructors
when there are secondary constructors has side effects
on ConstructorResolver. It seems reasonable to
require explicit @Autowired annotation in such case.

With this commit, implicit autowiring of Kotlin
primary constructors is only performed when there
is a primary constructor defined alone or with
a default constructor (define explicitly or
generated via the kotlin-noarg compiler plugin
or via optional constructor parameters with default
values).

Issue: SPR-16022
2017-11-14 09:25:46 +01:00
Juergen Hoeller b5cedd43eb Consistent and efficient access to BeanDefinition argument values
Issue: SPR-16192
2017-11-13 21:51:11 +01:00
Juergen Hoeller a5da05c3dc Comprehensive documentation on injection point matching
Issue: SPR-16142
2017-11-10 20:20:13 +01:00
sdeleuze 1a246c0a67 Fix ListableBeanFactory Kotlin extensions return types 2017-11-07 13:51:53 +01:00
Juergen Hoeller 9649b0cb25 Properly resolve null beans as getBeansOfType result entries
Issue: SPR-16163
2017-11-06 13:27:51 +01:00
Juergen Hoeller 5f270bc432 Upgrade to SnakeYAML 1.19 2017-10-18 12:17:13 +02:00
Juergen Hoeller 91a8993895 Skip init/destroy method check for null beans
Issue: SPR-16063
2017-10-12 15:31:57 +02:00
Juergen Hoeller c9d3c2690d Properly resolve null candidates for collection injection
Issue: SPR-16033
2017-10-02 12:27:11 +02:00
Juergen Hoeller ec345bf162 Revised handling of missing data class arguments
Includes unified detection of Kotlin's optional parameters in MethodParameter.isOptional(), reduces BeanUtils.findPrimaryConstructor to Kotlin semantics (for reuse in AutowiredAnnotationBeanPostProcessor), and finally introduces a common KotlinDetector delegate with an isKotlinType(Class) check.

Issue: SPR-15877
Issue: SPR-16020
2017-09-28 00:31:12 +02:00
Sebastien Deleuze fb09a75c82 Improve support of Kotlin beans w/ primary and default ctors
This commit add the default constructor if available as
fallback after to the primary constructor.

Issue: SPR-16012
2017-09-27 11:27:00 +02:00
Juergen Hoeller efce7902c4 Polishing 2017-09-27 01:34:11 +02:00
Juergen Hoeller e927cae476 ObjectProvider offers ifAvailable/ifUnique variants with Consumer
Issue: SPR-16001
2017-09-25 22:45:15 +02:00
Sebastien Deleuze 3996f33399 Support non-standard classes in Kotlin reflection discovery methods
Issue: SPR-15999
2017-09-24 23:10:40 +02:00
Juergen Hoeller 9190b76ab9 Latest dependency updates (POI 3.17, Rome 1.8, EhCache 3.4, Caffeine 2.5.6, RxJava 2.1.4, Tomcat 8.5.21, JRuby 9.1.13, Rhino 1.7.7.2) 2017-09-23 11:28:19 +02:00
Juergen Hoeller 7ae59d0c2a Nullability refinements on private and static methods
Based on IntelliJ IDEA 2017.3 introspection results.

Issue: SPR-15756
2017-09-22 18:22:14 +02:00
Sebastien Deleuze d8e52c0413 Refine BeanUtils#findPrimaryConstructor behavior
Issue: SPR-15673
2017-09-22 13:40:37 +02:00
Sebastien Deleuze 1bc93e3d0f Revisit nullability annotations
This commit introduces the following changes.

1) It adds a new Spring @NonNull annotation which allows to apply
@NonNullApi semantic on a specific element, like @Nullable does.
Combined with @Nullable, it allows partial null-safety support when
package granularity is too broad.

2) @Nullable and @NonNull can apply to ElementType.TYPE_USE in order
to be used on generic type arguments (SPR-15942).

3) Annotations does not apply to ElementType.TYPE_PARAMETER anymore
since it is not supported yet (applicability for such use case is
controversial and need to be discussed).

4) @NonNullApi does not apply to ElementType.FIELD anymore since in a
lot of use cases (private, protected) it is not part for the public API
+ its usage should remain opt-in. A dedicated @NonNullFields annotation
has been added in order to set fields default to non-nullable.

5) Updated Javadoc and reference documentation.

Issue: SPR-15756
2017-09-15 13:26:41 +02:00
Juergen Hoeller 4371350b5d Polishing 2017-09-10 21:56:31 +02:00
Stephane Nicoll 71182ab54b Provide hierarchy traversal support for getBeanNamesForAnnotation
Issue: SPR-15923
2017-09-03 08:19:34 +02:00
Brian Clozel 397fd24849 Revert "Leverage Kotlin plugin dependency management"
This reverts commit 3e2f6c848a.
2017-08-22 21:29:39 +02:00
Sebastien Deleuze 3e2f6c848a Leverage Kotlin plugin dependency management 2017-08-22 17:35:57 +02:00
Sebastien Deleuze ef68ccdbd8 Add support for Kotlin autowired ctors w/ optional params
This commit adds support for autowired constructor parameters
on Kotlin classes with optional parameters. If some constructor
parameters are not available, optional parameter default values
will be used instead. Both explicit @Autowired annotated constructor
and implicit single constructor automatically autowired are supported.

Issue: SPR-15847
2017-08-22 17:05:18 +02:00
Sebastien Deleuze ab6430569d Efficient Kotlin metadata detection
Follow-up of 3991ab4a23.

Issue: SPR-15673
2017-08-22 16:22:25 +02:00
Brian Clozel 41cbc4670f Refactor the spring-beans build
This commit merges back the "spring-beans-groovy" module into the main
"spring-beans" one. The build is configured so:

* Java and Groovy sources are jointly compiled
* Kotlin sources are compiled after

With this change, the `MergePlugin` is not used anymore in the project
build and therefore is removed.
The `DetectSplitPackagesPlugin` wasn't applied so it's been removed as
well.

Issue: SPR-15885
2017-08-21 14:41:46 +02:00
Juergen Hoeller 3991ab4a23 Efficient Kotlin metadata detection
Issue: SPR-15673
2017-08-21 01:33:20 +02:00
Juergen Hoeller ac5e2599f7 Consistent overriding for all variants of init/destroy method inheritance
Issue: SPR-15532
2017-08-18 00:13:49 +02:00
Juergen Hoeller b94302b5bd Enforce non-null value from getBean and at injection points
Bean-derived null values may still get passed into bean properties and injection points but only if those are declared as non-required. Note that getBean will never return null; a manual bean.equals(null) / "null".equals(bean.toString()) check identifies expected null values now.  This will only ever happen with custom FactoryBeans or factory methods returning null - and since all common cases are handled by autowiring or bean property values in bean definitions, there should be no need to ever manually check for such a null value received from getBean.

Issue: SPR-15829
2017-08-18 00:11:35 +02:00
Sebastien Deleuze 73cf07e9a4 Fix overridden methods nullability
Issue: SPR-15869
2017-08-17 15:02:59 +02:00
Sebastien Deleuze ef175d7ca6 Fix BeanUtils#instantiateClass w/ Kotlin + noarg constructor
Issue: SPR-15851
2017-08-14 15:14:02 +02:00
Juergen Hoeller adeb521ce4 Polishing 2017-08-08 17:27:28 +02:00
Juergen Hoeller 09f5c71374 Consistent nullability for BeanDefinitionBuilder setters
Issue: SPR-15841
2017-08-08 17:26:45 +02:00
Sebastien Deleuze ed6fe2b723 Upgrade to Kotlin 1.1.4-eap-33
Issue: SPR-15814
2017-07-24 17:29:02 +02:00
Juergen Hoeller 40df7b6eca Polishing
Issue: SPR-15673
2017-07-20 13:16:50 +02:00
Sebastien Deleuze fa4d139684 Support instantiating Kotlin classes with optional parameters
This commit updates BeanUtils class in order to add Kotlin optional
parameters with default values support to the immutable data classes
support introduced by SPR-15199.

Issue: SPR-15673
2017-07-20 10:44:06 +02:00
Juergen Hoeller 46eba3dbfa Nullability fine-tuning around declaration inconsistencies
Issue: SPR-15720
Issue: SPR-15792
2017-07-19 22:22:20 +02:00
Juergen Hoeller 9fc4fb10b0 Nullability fine-tuning around bean properties
Issue: SPR-15720
Issue: SPR-15792
2017-07-19 11:43:58 +02:00
Sebastien Deleuze fb4ddb0746 Make getters and setters null-safety consistent
This commit ensure that null-safety is consistent between
getters and setters in order to be able to provide beans
with properties with a common type when type safety is
taken in account like with Kotlin.

It also add a few missing property level @Nullable
annotations.

Issue: SPR-15792
2017-07-19 09:07:56 +02:00
Juergen Hoeller fd2b4f2427 DefaultListableBeanFactory falls back to empty DLBF instance on deserialization
Issue: SPR-15766
(cherry picked from commit c9ffa64)
2017-07-13 13:19:45 +02:00
Juergen Hoeller 6c0ae1ec9b Clarified role of postProcessAfterInstantiation
Issue: SPR-15732
2017-07-05 00:01:38 +02:00
Juergen Hoeller 6534359473 FactoryBean object cache cleared on shutdown
Issue: SPR-15722
2017-06-30 20:57:15 +02:00
Juergen Hoeller cc74a2891a @Nullable all the way: null-safety at field level
This commits extends nullability declarations to the field level, formalizing the interaction between methods and their underlying fields and therefore avoiding any nullability mismatch.

Issue: SPR-15720
2017-06-30 01:54:16 +02:00
Sebastien Deleuze d728d597f2 Add missing license headers in Kotlin files 2017-06-27 14:39:26 +02:00
Sebastien Deleuze 04d5a2951c Remove KClass based Kotlin extensions
Issue: SPR-15660
2017-06-13 18:43:59 +02:00
Stephane Nicoll 58242f2249 Polish 2017-06-13 10:13:14 +02:00
Stephane Nicoll fc64b8040f Polish "Replace relevant code with lambda"
Closes gh-1454
2017-06-13 09:42:20 +02:00
diguage 4b1478d830 Replace relevant code with lambda
See gh-1454
2017-06-13 08:55:38 +02:00
Stephane Nicoll 451b419624 Polish "Use Map#forEach instead of Map#entrySet#forEach"
Closes gh-1449
2017-06-12 14:37:33 +02:00
diguage 2efa06237a Use Map#forEach instead of Map#entrySet#forEach
See gh-1449
2017-06-12 14:37:33 +02:00
diguage c1d44d9a34 Use the diamond syntax
Closes gh-1450
2017-06-12 09:19:06 +02:00
Stephane Nicoll 27aabb15f9 Polish "Refact iterator of Map with Java 8 forEach"
Closes gh-1451
2017-06-12 08:53:56 +02:00
diguage dab7a7f0ee Refact iterator of Map with Java 8 forEach
See gh-1451
2017-06-12 08:11:32 +02:00
Juergen Hoeller e2e0410570 Method-level javadoc on XmlReaderContext etc 2017-06-11 12:03:05 +02:00
Juergen Hoeller c0550f7eb6 Documented AbstractBeanFactory nullability warning
Issue: SPR-15540
2017-06-09 20:46:15 +02:00
Sebastien Deleuze 86580b2358 Polishing 2017-06-09 01:49:56 +03:00
Sebastien Deleuze 8579ae66fc Add comprehensive tests of Kotlin extensions
This commit also removes extensions hidden by Java API (varargs).
2017-06-09 01:01:16 +03:00
Juergen Hoeller fd53d2a51a Consistent use of @Nullable in spring-test
This commit also removes nullability from two common spots: ResolvableType.getType() and TargetSource.getTarget(), both of which are never effectively null with any regular implementation. For such scenarios, a non-null empty type/target is the cleaner contract.

Issue: SPR-15540
2017-06-08 22:52:59 +02:00
Juergen Hoeller f813712f5b Consistent use of @Nullable across the codebase (even for internals)
Beyond just formally declaring the current behavior, this revision actually enforces non-null behavior in selected signatures now, not tolerating null values anymore when not explicitly documented. It also changes some utility methods with historic null-in/null-out tolerance towards enforced non-null return values, making them a proper citizen in non-null assignments.

Some issues are left as to-do: in particular a thorough revision of spring-test, and a few tests with unclear failures (ignored as "TODO: NULLABLE") to be sorted out in a follow-up commit.

Issue: SPR-15540
2017-06-07 14:19:15 +02:00
Sebastien Deleuze 1f28825f9d Add more @Nullable parameters based on null usage
Issue: SPR-15540
2017-05-31 21:42:23 +02:00
Sebastien Deleuze c3e6afb879 Improve null-safety to fix some Spring Boot warnings
Issue: SPR-15540
2017-05-31 17:14:49 +02:00
Sebastien Deleuze b47d713e14 Add missing @Nullable annotations on parameters
Issue: SPR-15540
2017-05-31 16:56:08 +02:00
Sebastien Deleuze 87598f48e4 Introduce null-safety of Spring Framework API
This commit introduces 2 new @Nullable and @NonNullApi
annotations that leverage JSR 305 (dormant but available via
Findbugs jsr305 dependency and already used by libraries
like OkHttp) meta-annotations to specify explicitly
null-safety of Spring Framework parameters and return values.

In order to avoid adding too much annotations, the
default is set at package level with @NonNullApi and
@Nullable annotations are added when needed at parameter or
return value level. These annotations are intended to be used
on Spring Framework itself but also by other Spring projects.

@Nullable annotations have been introduced based on Javadoc
and search of patterns like "return null;". It is expected that
nullability of Spring Framework API will be polished with
complementary commits.

In practice, this will make the whole Spring Framework API
null-safe for Kotlin projects (when KT-10942 will be fixed)
since Kotlin will be able to leverage these annotations to
know if a parameter or a return value is nullable or not. But
this is also useful for Java developers as well since IntelliJ
IDEA, for example, also understands these annotations to
generate warnings when unsafe nullable usages are detected.

Issue: SPR-15540
2017-05-27 08:57:01 +02:00
Juergen Hoeller f985f71daf Polishing 2017-05-12 12:50:17 +02:00
Juergen Hoeller 652266bcc2 Polishing 2017-05-04 22:27:36 +02:00
Juergen Hoeller 27057889f8 Polishing 2017-05-03 13:45:29 +02:00
Juergen Hoeller d74542ed21 Honor @Autowired(required=false) at parameter level
Includes a revision of the AutowireCandidateResolver SPI with default methods.

Issue: SPR-15268
2017-05-03 13:42:16 +02:00
Stephane Nicoll 1b9e12f52f Polish "Use Java 8 forEach method on Map"
Closes gh-1404
2017-04-28 11:07:08 +02:00
Jon Borenstein 13dc0cd828 Use Java 8 forEach method on Map 2017-04-28 11:07:08 +02:00
Juergen Hoeller c668d9a473 Polishing 2017-04-26 18:20:19 +02:00
Juergen Hoeller a95843a068 Dependency tracking for Supplier-created beans
Issue: SPR-15417
2017-04-07 18:01:28 +02:00
Sebastien Deleuze e2fd398bad Specify explicitly Kotlin extensions return type
The main purpose is to specify nullability.
2017-03-30 14:25:13 +02:00
Sam Brannen 7a01771a45 Polishing 2017-03-28 19:27:03 +02:00
Sebastien Deleuze 9963c4a495 Fix Kotlin warnings 2017-03-10 10:35:30 +01:00
Juergen Hoeller 6556b40c2b Upgrade to SnakeYAML 1.18 (with updated duplicate key tests)
Includes updates to Caffeine 2.4, Jetty 9.4.2, Undertow 1.4.11, RxJava 1.2.7 and Groovy 2.4.9.
2017-02-28 13:19:33 +01:00
stonio 7d062df992 Use String#isEmpty()
Closes gh-1335
2017-02-22 11:55:17 +01:00
Juergen Hoeller 0da8dee289 Polishing 2017-02-16 16:24:13 +01:00
Juergen Hoeller 8d707eb530 Polishing 2017-02-16 15:37:31 +01:00
Juergen Hoeller 9543384d9e Avoid deprecated comparators in tests
Issue: SPR-14779
2017-02-16 15:36:27 +01:00
Kazuki Miyahara e95391765c Fix typo in Javadoc 2017-02-16 18:22:44 +09:00
Stephane Nicoll d4dd8baed5 Update copyright header
Closes gh-1327
2017-02-14 10:39:54 +01:00
hengyunabc 2723bd092c Fix typo
See gh-1327
2017-02-14 10:36:14 +01:00
Juergen Hoeller 65d8d698cd Test for ObjectFactory injection at constructor level
Issue: SPR-15222
2017-02-10 10:42:48 +01:00
Juergen Hoeller 1b2dc3638f Revisit Assert to avoid single-arg assert methods (with refined messages)
Issue: SPR-15196
2017-01-30 22:15:55 +01:00
Juergen Hoeller 4a57d4512e Reset cached ResolvableType on increaseNestingLevel/setContainingClass
Issue: SPR-15160
2017-01-25 00:30:05 +01:00
Juergen Hoeller 5e946c2700 Consistent type variable resolution for arrays/collections (in particular at field level)
Dropping GenericCollectionTypeResolver in favor of direct ResolvableType usage.

Issue: SPR-15160
2017-01-24 18:00:17 +01:00
Juergen Hoeller ed40b1c8ee Remove outdated abstractions/delegates from core/util
Issue: SPR-15159
2017-01-23 13:41:55 +01:00
Juergen Hoeller ac6aa53031 Drop outdated BeanFactoryLocator / beanRefContext.xml mechanism
Issue: SPR-15154
2017-01-17 13:58:37 +01:00
Juergen Hoeller 46fc7fba8f Polishing 2017-01-16 23:08:44 +01:00
Juergen Hoeller 32fc855dd1 Introspect FactoryBean class declaration if no early instantiation possible
Issue: SPR-15125
2017-01-16 12:00:38 +01:00
Juergen Hoeller 1cb381e9a7 Consistent deprecation markers on JDK 9 2017-01-13 10:53:20 +01:00
Juergen Hoeller 8084da59a7 Map resolution for multiple beans applies to plain Map interface declaration only
Issue: SPR-15117
2017-01-12 21:15:41 +01:00
Juergen Hoeller 9e6aa0ff59 BeanDefinitionBuilder supports factory method on factory bean
Issue: SPR-15098
2017-01-12 21:15:22 +01:00
Sebastien Deleuze 0a988fd2b1 Remove object wrappers in Kotlin extensions
This commit also improve significantly Kotlin extensions
documentation.

Issue: SPR-15127
2017-01-11 08:52:01 +01:00
Sebastien Deleuze 4f1fe74912 Polish ListableBeanFactoryExtension 2017-01-11 07:57:02 +01:00
Sebastien Deleuze f8461d856a Support Gradle-style Kotlin bean API
val context = GenericApplicationContext {
    registerBean<Foo>()
    registerBean { Bar(it.getBean<Foo>()) }
}

Issue: SPR-15126
2017-01-10 21:43:27 +01:00
Juergen Hoeller e8a082fbe1 Clarified setAutowireCandidate semantics (plus attribute reordering in BeanDefinition)
Issue: SPR-15072
2016-12-30 11:30:18 +01:00
Juergen Hoeller fc629bb508 Polishing 2016-12-29 22:39:36 +01:00
Juergen Hoeller edc62be231 @Scheduled reliably applies after other post-processors and shuts down before TaskScheduler
Issue: SPR-14692
Issue: SPR-15067
2016-12-29 22:35:10 +01:00
Juergen Hoeller 209e7a700d Avoid FactoryBean initialization on isSingleton check for decorated bean definition
Issue: SPR-14892
Issue: SPR-15042
2016-12-28 17:27:06 +01:00
Sebastien Deleuze 6a850ee688 Polishing 2016-12-27 10:08:12 +01:00
Juergen Hoeller 64d6561cbb AbstractNestablePropertyAccessor's setPropertyValue refactored into several delegate methods
Issue: SPR-15053
2016-12-26 19:47:26 +01:00
Sebastien Deleuze ff675f5226 Add Kotlin extensions for bean registration and retrieval
Issue: SPR-15048
2016-12-26 14:21:10 +01:00
Juergen Hoeller f805427629 Detect generic type match behind interface-based proxy as well
Issue: SPR-14097
2016-12-26 11:23:07 +01:00
Juergen Hoeller fd41f63ec0 Clarify programmatic contract (no annotation-driven injection)
Issue: SPR-8704
2016-12-26 10:57:50 +01:00
Juergen Hoeller d3f97e3092 ObjectProvider offers getIfAvailable/getIfUnique variants with default supplier
Issue: SPR-14980
2016-12-23 18:49:12 +01:00
Juergen Hoeller e788b8467d GenericApplicationContext offers Supplier-based registration with BeanDefinitionCustomizer callback
Issue: SPR-14832
2016-12-23 12:26:47 +01:00
Juergen Hoeller 154ef8bf10 Polishing 2016-12-20 19:57:52 +01:00
Juergen Hoeller 3ee6286eb5 Support for functional instance supplier callback at BeanDefinition level
Issue: SPR-14832
2016-12-18 21:05:45 +01:00
Juergen Hoeller 12aa14ddbc Support @Nullable annotations as indicators for optional injection points
Issue: SPR-15028
2016-12-18 21:04:08 +01:00
Juergen Hoeller 4c005e6336 ResolvableType-based matching respects generic factory method return type
Includes consistent use of ResolvableType.resolve() wherever applicable.

Issue: SPR-15011
2016-12-17 23:10:48 +01:00
Juergen Hoeller 39d2769bd0 Autodetect Kotlin nullability for optional injection points (analogous to java.util.Optional)
Built-in support in MethodParameter and DependencyDescriptor supersedes our separate KotlinUtils helper.

Issue: SPR-14951
2016-12-13 17:38:58 +01:00
Juergen Hoeller 8b5ee4ef91 AutowiredAnnotationBeanPostProcessor tolerates annotated no-arg constructors
Issue: SPR-15005
2016-12-12 22:26:24 +01:00
Juergen Hoeller 547b9638dc Collection injection may refer back to factory methods on same bean again
Issue: SPR-14996
2016-12-09 23:09:10 +01:00
Juergen Hoeller ac5933a7ac Various DefaultListableBeanFactory clarifications
* getBeanDefinitionNames defensively returns a copy of the bean definition names array.
* copyConfigurationFrom provides an independent AutowireCandidateResolver instance and copies a ConversionService and dependency comparator configuration as well.
* findAutowireCandidates only considers a self reference fallback for direct dependency declarations, not as a collection element.

Issue: SPR-14897
Issue: SPR-14921
Issue: SPR-14965
2016-11-30 22:07:55 +01:00
Juergen Hoeller b22a59a0c4 Polishing 2016-11-24 15:32:06 +01:00
Juergen Hoeller 85b0ce1ef7 Avoid defensive checks against java.time API
Issue: SPR-13188
2016-11-22 14:55:03 +01:00
Juergen Hoeller da63898d5f Polishing 2016-11-21 17:36:04 +01:00
Juergen Hoeller b3cd1ad7f1 Refined throwing of BeanCreationExceptions (and reflection exceptions)
Issue: SPR-14883
2016-11-07 19:03:18 +01:00
Juergen Hoeller cf479bf893 Consistent throwing of BeanCreationExceptions (and reflection exceptions)
Issue: SPR-14883
(cherry picked from commit b42d731)
2016-11-07 18:00:21 +01:00
Juergen Hoeller 7f4904ed22 Avoid deprecated Mockito methods
Issue: SPR-14880
2016-11-04 20:39:53 +01:00
Juergen Hoeller 84d3808b3b Upgrade to Mockito 2.2
Issue: SPR-14880
2016-11-03 22:53:35 +01:00
Juergen Hoeller 8053fefea8 Consistent support for early placeholder resolution in properties locations
Issue: SPR-10502
2016-11-03 14:33:48 +01:00
Juergen Hoeller dc080cb1be Revised NoSuchBeanDefinitionException message and ResolvableType handling
Includes consistent quoting of qualified type names in related classes.

Issue: SPR-14831
2016-10-28 23:39:05 +02:00
Juergen Hoeller 36332441ae DefaultListableBeanFactory allows early type matching against ScopedProxyFactoryBean
Issue: SPR-14816
2016-10-28 23:37:58 +02:00
Juergen Hoeller 20419d72ef Tightened StringValueResolver contract
Issue: SPR-14842
2016-10-28 15:28:42 +02:00
Stephane Nicoll 3a34cdba81 Polish contribution
Closes gh-1203
2016-10-26 09:49:50 +02:00
Vitalii 2980e59298 Fix javadoc syntax
See gh-1203
2016-10-26 09:46:14 +02:00
Stephane Nicoll 827bc78e34 Polish 2016-10-24 20:12:18 +02:00
Stephane Nicoll b7d85f8ebc Expose ResolvableType in NoSuchBeanDefinitionException
This commit improves NoSuchBeanDefinitionException to expose a full
ResolvableType rather than a raw class if a lookup by type failed. This
allows to know more about the underlying type and is typically useful
when a collection or map is required as the relevant generic type is the
actual bean that wasn't found.

Issue: SPR-14831
2016-10-24 17:43:54 +02:00
Juergen Hoeller 3726c6f18d Polishing 2016-10-21 12:26:27 +02:00
Stephane Nicoll fc8bad36c9 Fix formatting
Closes gh-1206
2016-10-15 11:55:07 +03:00
Philippe Marschall ae5b0c6fb5 Replace J2EE with Java EE
String with version 5 the name of Java Platform, Enterprise Edition
changed from J2EE to Java EE. However a lot of the documentation still
uses the term J2EE.

This commit includes the following changes:

 * replace J2EE with Java EE where appropriate

This is not a blind search and replace. The following occurrences
remain unchanged:

 * references to old J2EE releases, most notably 1.3 and 1.4.
 * references to "Expert One-On-One J2EE Design and Development"
 * references to "Core J2EE patterns"
 * XML namespaces
 * package names

Issue: SPR-14811
See gh-1206
2016-10-15 11:49:00 +03:00
Juergen Hoeller c64f39943f Polishing 2016-09-26 17:20:30 +02:00
Juergen Hoeller 74c618892e YamlPropertiesFactoryBean consistently exposes String values
Issue: SPR-14737
2016-09-25 21:05:40 +02:00
Juergen Hoeller 2b2cc2d1ca Rearranged field order in RootBeanDefinition
Issue: SPR-14725
2016-09-16 10:34:05 +02:00
Stephane Nicoll 2b0bf9f04a Add Qualified element on RootBeanDefinition
Improve RootBeanDefinition to specify an AnnotatedElement that holds
qualifier information. When such element is present, any qualifier that
it defines will be used to find a matching candidate.

Issue: SPR-14725
2016-09-16 09:20:31 +02:00
Juergen Hoeller f592599349 Polishing
(cherry picked from commit 54db496)
2016-09-13 23:48:41 +02:00
Juergen Hoeller c69e6a36f7 Revised IllegalArgumentException handling for Formatter parse calls
Issue: SPR-14661
2016-09-13 21:55:20 +02:00
Juergen Hoeller 0c2e8a6246 Consistent callbacks for TypeFilters, ImportSelectors and ImportBeanDefinitionRegistrars
Issue: SPR-14686
2016-09-13 21:49:24 +02:00
Juergen Hoeller fa820bc0c9 PropertyValue stores source object in common superclass field
Issue: SPR-8337
2016-09-13 21:29:05 +02:00
Juergen Hoeller 41f7680e20 Polishing 2016-08-25 00:20:18 +02:00
Juergen Hoeller c4fcdb6864 DefaultListableBeanFactory does not trigger early candidate creation ahead of primary bean selection
Issue: SPR-14611
2016-08-24 22:56:47 +02:00
Juergen Hoeller 3d297b10e9 NamedBeanHolder enforces bean name
Issue: SPR-7549
2016-08-24 14:29:45 +02:00
Juergen Hoeller 93d2287894 UnsatisfiedDependencyException avoids duplicate nested exception message
Issue: SPR-14607
2016-08-23 13:21:40 +02:00
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
Juergen Hoeller 9d6c38bd54 Consistent bracket alignment 2014-07-18 17:21:58 +02:00
Juergen Hoeller 2665d56209 Polishing 2014-07-15 15:13:35 +02:00
Juergen Hoeller a4968b9015 DefaultListableBeanFactory's registerBeanDefinition only calls resetBeanDefinition in case of pre-existing bean definition or pre-existing singleton instance
Issue: SPR-8318
2014-07-15 15:05:13 +02:00
Stephane Nicoll b676c41805 Add missing 4.1 XSDs
This commit adds the missing 4.1 XSDs for the following components:

* spring-aop
* spring-context
* spring-jee
* spring-lang
* spring-tx
* spring-util

These are strictly identical to the definition of the 4.0 XSDs.

Issue: SPR-11990
2014-07-14 17:59:54 +02:00
Juergen Hoeller 2bd6e24b65 MBeanExporter implements newly introduced SmartInitializingSingleton callback interface
Issue: SPR-8045
2014-07-10 15:48:36 +02:00
Juergen Hoeller a6a86b8025 DefaultBeanDefinitionDocumentReader evaluates profile attribute only in beans namespace
Issue: SPR-11975
2014-07-09 21:17:43 +02:00
Stephane Nicoll b78b2e9a03 Fix priority semantic
Commit 5fe8f52 introduced a support for @Priority as an alternative to
@Primary but it broke the semantic of the priority value. This commit
fixes this inconsistency.

As for @Order, the lowest value means the highest priority so if
several beans are candidates for injection, the one having the lowest
value will be used.

Issue: SPR-10548
2014-07-08 10:26:03 +02:00
Juergen Hoeller 01264dc673 Polishing 2014-07-08 00:59:31 +02:00
Juergen Hoeller 6c41cc354c ConstructorResolver's exception message on null factory-bean hints at potential BeanPostProcessor involvement
Issue: SPR-11951
2014-07-04 22:30:19 +02:00
Juergen Hoeller 87cbade8be Test variant for SPR-11521 (currently @Ignored)
Issue: SPR-11521
2014-07-02 15:13:34 +02:00
Juergen Hoeller d870b382da Defensively check for pre-resolved FactoryBean.getObject() results in circular reference scenarios
Issue: SPR-11937
2014-07-01 23:50:17 +02:00
Juergen Hoeller b7984f21d8 Polishing 2014-07-01 20:30:31 +02:00
Juergen Hoeller f8b6114440 BeanFactoryAnnotationUtils consistently applies bean name fallback when no BeanDefinition present
Issue: SPR-11915
2014-07-01 16:29:40 +02:00
Juergen Hoeller 974bd43f28 AbstractAutowireCapableBeanFactory's createBean/autowireBean/configureBean use CacheUtils.isCacheSafe to re-enable PropertyDescriptor caching
Issue: SPR-11875
2014-06-30 00:58:44 +02:00
Juergen Hoeller fab67b0595 CachedIntrospectionResults and co consistently avoid synchronization (through use of ConcurrentReferenceHashMap)
As a side effect, through ConcurrentReferenceHashMap, we're using soft references for non-cache-safe bean classes.

Issue: SPR-11867
2014-06-30 00:16:15 +02:00
Stephane Nicoll 8221c9abc5 Support for nested path using field access
This commit adds a nested path support for DirectFieldAccessor that is
similar to what BeanWrapper provides. It is now possible to use
expressions such as "person.address.city.name" to access the name of
the city that a given person lives in using fields to traverse the
graph.

DirectFieldAccessor also now supports an auto-grow option to create
a default instance for a "null" intermediate path. This option is
false by default and leads to a NullValueInNestedPathException in such
a case.

This commit also harmonizes part of the tests suite so that core tests
are shared between BeanWrapperImpl and DirectFieldAccessor.

Note that map and list access is not implemented as part of this
commit.

Issue: SPR-9705
2014-06-26 19:22:02 +02:00
Juergen Hoeller d6635802c4 TypeDescriptor's nested type traversal leniently returns null in case of unresolvable nested type
Issue: SPR-11898
2014-06-24 20:57:09 +02:00
Juergen Hoeller bc1f19ce18 Defensively check javaUtilOptionalEmpty
Issue: SPR-11888
2014-06-19 21:14:43 +02:00
Rossen Stoyanchev 0dc6082b01 Support java.util.Optional for @MVC named value args
After this change, java.util.Optional is supported with @RequestParam,
@RequestHeader, and @MatrixVariable arguments in Java 8. When Optional
is used the required flag is effectively ignored.

Issue: SPR-11829
2014-06-16 14:16:56 -04:00
Juergen Hoeller ea346d59b3 Polishing 2014-06-07 00:25:06 +02:00
Juergen Hoeller 85b2c7d116 AbstractAutowireCapableBeanFactory's getTypeForFactoryBean considers FactoryBean<Object> declarations as non-indicative (just like raw declarations)
Issue: SPR-11842
2014-06-06 18:43:29 +02:00
Juergen Hoeller 5cb3f8eada Support for java.util.Optional within ObjectFactory/Provider
Includes support for arbitrary deep nesting levels in DependencyDescriptor's getDependencyType() and MethodParameter's getNestedParameterType().

Issue: SPR-11833
2014-06-06 15:29:50 +02:00
Juergen Hoeller 7d03daf8cb Support for Java 8's java.util.Optional at injection points
Issue: SPR-11833
2014-06-06 14:41:01 +02:00
Juergen Hoeller f7b465390c Moved @Uses annotations to org.springframework.lang; fixed Base64Utils to declare Java 8, and fixed PathResource's declaration to refer to Java 7.
Issue: SPR-11604
2014-06-04 21:34:23 +02:00
Alex Yursha 8b8afe3def Fix a typo 2014-06-04 21:16:17 +02:00
Stephane Nicoll 001d0e734c Support for @Order at the bean declaration level
This commit introduces OrderProvider and OrderProviderComparator, two
interfaces designed to externalize how a collection of element is sorted
according to their order value.

FactoryAwareOrderProvider is an OrderProvider implementation that knows
about the objects to order and the corresponding BeanFactory instance.
This allows to retrieve additional metadata about the actual instances
to sort, such as its factory method.

A @Bean method can now holds an additional @Order to define the order
value that this bean should have when injected as part of a collection
or array.

Issue: SPR-11310
2014-06-04 21:04:13 +02:00
Juergen Hoeller 551950cdc0 Consistent use of ClassUtils.forName instead of class.getClassLoader().loadClass
Issue: SPR-11780
2014-05-15 09:56:11 +02:00
Juergen Hoeller 6c1f8de5fa Eventual removal of deprecated AbstractBeanConfigurerAspect, BeanReferenceFactoryBean and CommonsLogFactoryBean 2014-05-08 16:24:22 +02:00
Stephane Nicoll 580e52372f Add support of YAML
This commit migrates the YAML support available in Spring Boot to
the core framework. YAML documents can be loaded either as a
properties object or as a map.

Issue: SPR-9897
2014-05-08 12:02:20 +02:00
Juergen Hoeller a653c06711 Fixed invalid code tag in javadoc
(cherry picked from commit a139670)
2014-05-01 00:53:10 +02:00
Stephane Nicoll bd85c916eb Integrate animal sniffer
Animal sniffer provides tools to assist verifying that classes
compiled with a newer JDK are compatible with an older JDK.

This integratesthe latest version of the tool (1.11) that
permits the use of custom annotations. Added @UsesJava7,
@UsesJava8 and @UsesSunHttpServer and annotated the few places
where we rely on a specific environment.

The verification process can be invoked by running the 'sniff'
task.

Issue: SPR-11604

polishing
2014-04-30 13:51:01 +02:00
Juergen Hoeller 0ef29b204b GenericBeanDefinition's toString() takes parent definition into account
Issue: SPR-9671
2014-04-28 13:59:51 +02:00
Juergen Hoeller 6cb45f714e General defensiveness about the bootstrap ClassLoader (i.e. null ClassLoader)
Issue: SPR-11721
(cherry picked from commit 59cef3c)
2014-04-28 00:47:21 +02:00
Stephane Nicoll 5559209233 Remove useless imports 2014-04-22 09:57:12 +02:00
Juergen Hoeller 14f9dbf70c Consistent documentation for both 'close' and 'shutdown' as inferred destroy methods
Issue: SPR-11680
2014-04-10 22:52:22 +02:00
Juergen Hoeller 8ed490c4d7 Polishing 2014-04-02 20:57:28 +02:00
Stephane Nicoll db23ec733b Add exception handling of asynchronous method
Prior to this commit, an exception thrown by an @Async void method
was not further processed as there is no way to transmit that
exception to the caller.

The AsyncUncaughtExceptionHandler is a new strategy interface that
can be implemented to handle unexpected exception thrown during the
invocation of such asynchronous method.

The handler can be specified using either the XML namespace or by
implementing the AsyncConfigurer interface with the EnableAsync
annotation.

Issue: SPR-8995
2014-04-02 15:04:40 +02:00
Stephane Nicoll dcf5f4a6a3 javax.annotation.Priority alternative to @Order
This commit rationalizes the use of @Order so that the standard
@Priority annotation can be used instead. The handling of both
annotations are now defined in OrderUtils.

This also updates the link to the JavaEE API so that we refer to
JavaEE7 instead of JavaEE6.

Issue: SPR-11639
2014-04-01 14:30:47 +02:00
Stephane Nicoll 5fe8f52c02 Add support for @Priority
This commit adds support for @Priority to filter multiple candidates
for autowiring. When multiple candidates are available for a given
bean, the bean annotated with @Primary is used. If none exists, the
one with the higher value for the @Priority annotation is used. If
two beans have the same priority a NoUniqueBeanDefinitionException
is thrown, just as if two beans are annotated with @Primary.

The underlying code for #getBean and #resolveDependency has been
merged as this feature is available for both dependency injection
and bean lookup by type.

Issue: SPR-10548
2014-03-31 15:49:10 +02:00
Stephane Nicoll 48221798f5 Improving test coverage of determinePrimaryCandidate
Added tests checking the behaviour of autowiring by type when the @Primary
annotation is present on the class. Fixed also some inconsistencies in the
code.
2014-03-31 15:37:55 +02:00
Stephane Nicoll 4cd818b9e4 Harmonize log configuration
Prior to this commit, the codebase was using a mix of log4j.xml
and log4j.properties for test-related logging configuration. This
can be an issue as log4j takes the xml variant first when looking
for a default bootstrap configuration.

In practice, some modules declaring the properties variant were
taking the xml variant configuration from another module.

The general structure of the configuration has also been
harmonized to provide a standard console output as well as an
easy way to enable trace logs for the current module.
2014-03-20 09:43:29 -07:00
Juergen Hoeller cf290ab42a Extracted simple MethodInvokingBean as alternative to (and base class for) MethodInvokingFactoryBean
Issue: SPR-11196
2014-03-17 15:13:59 +01:00
Juergen Hoeller 5308b3e358 Revised naming for prototype inner beans to avoid excessive unique name calculation
Restored original singleton-only adaptInnerBeanName behavior, avoiding endless unique name calculation for every single prototype instance. Non-named inner BeanDefinition objects now suffixed with an identity hex code analogous to non-named XML bean definitions, largely avoiding naming collisions to begin with. After SPR-11246, post-processors can deal with unstable classes per bean name, so occasional collisions aren't a hard problem anymore.

Issue: SPR-11545
2014-03-14 20:38:09 +01:00
Sam Brannen b364599278 Update links to Spring JIRA server 2014-03-10 12:26:29 +01:00
Juergen Hoeller 3dfa7e9ac0 Avoid stack overflow in case of circular type reference
Issue: SPR-11522
2014-03-07 00:08:15 +01:00
Juergen Hoeller 93c8b7ab04 DefaultListableBeanFactory only puts 'cache-safe' Class keys into its by-type cache
Issue: SPR-11520
2014-03-06 22:41:38 +01:00
Juergen Hoeller 7972b31118 SpringBeanELResolver's setValue should not throw PropertyNotWritableException if provided value is identical to current bean instance
Issue: SPR-11502
2014-03-06 14:17:54 +01:00
Juergen Hoeller 793cab4f80 Allow generics-based injection in case of nested unresolved type variable
Issue: SPR-11471
2014-03-06 14:13:33 +01:00
Juergen Hoeller ad317774fb instantiateUsingFactoryMethod avoids NPE and reports argument types in case of explicitArgs and resolved generic arguments as well
Issue: SPR-11517
2014-03-05 16:16:29 +01:00
Sam Brannen 206655c2b4 Polishing 2014-02-13 02:25:21 +01:00
Sam Brannen 8028eae786 Fix CGLIB memory leak for method injection
This commit continues the work for fixing memory leaks resulting from
CGLIB subclass generation for beans relying on method injection.

- Set proxy callbacks on the CGLIB Factory (i.e., the instance) instead
  of in the generated subclass (i.e., via the Enhancer).

- Convert private inner classes in CglibSubclassingInstantiationStrategy
  to private static classes in order to avoid unnecessary coupling to
  classes generated using CGLIB.

- Tidy up XmlBeanFactoryTests.

- Update logic in serializableMethodReplacerAndSuperclass() so that it
  finally aligns with the decision made for SPR-356.

Issue: SPR-10785, SPR-356
2014-02-13 01:45:41 +01:00
Juergen Hoeller ce39146be8 Polishing 2014-02-13 01:08:35 +01:00
Juergen Hoeller 520ef9ec23 Polishing
Issue: SPR-11422
2014-02-12 23:48:37 +01:00
Juergen Hoeller 603cdea26e resolveFactoryMethodIfPossible considers nonPublicAccessAllowed and SecurityManager
Issue: SPR-11422
2014-02-12 23:48:16 +01:00
Sam Brannen 9534245660 Exclude overloaded from equals & hashCode in MethodOverride
Prior to this commit, the inclusion of the 'overloaded' flag in the
implementations of equals() and hashCode() in MethodOverride could lead
to adverse effects in the outcome of equals() in AbstractBeanDefinition.

For example, given two bean definitions A and B that represent the
exact same bean definition metadata for a bean that relies on method
injection, if A has been validated and B has not, then A.equals(B) will
potentially return false, which is not acceptable behavior.

This commit addresses this issue by removing the 'overloaded' flag from
the implementations of equals() and hashCode() for MethodOverride.

Issue: SPR-11420
2014-02-12 16:56:03 +01:00
Sam Brannen f77bf2422e Polish Javadoc for LookupOverride and related code 2014-02-09 00:30:44 +01:00
Juergen Hoeller 8c4e372558 Introduced SpringNamingPolicy for CGLIB
Issue: SPR-11398
2014-02-06 20:25:11 +01:00
Juergen Hoeller 6634c19e6a Related polishing
Issue: SPR-11386
2014-02-04 16:45:14 +01:00
Juergen Hoeller f27304d785 Avoid repeated assignability check for raw class on fallback match, since AutowireCandidateResolver is only being called for basic type matches to begin with
Issue: SPR-9965
2014-02-01 19:28:40 +01:00
Juergen Hoeller 8570f607a7 Fixed regression with fallback for non-resolvable property type 2014-01-28 17:16:50 +01:00
Juergen Hoeller fcbd3b121b Added test for inconsistency between read and write method
Issue: SPR-11361
2014-01-28 01:25:59 +01:00
Juergen Hoeller d004b634a5 Fixed type resolution in case of inconsistencies between read and write method
Issue: SPR-11361
2014-01-28 00:46:15 +01:00
Juergen Hoeller 5331da6aff Polishing 2014-01-25 00:27:27 +01:00
Juergen Hoeller defc1d3157 Drop Introspector.flushFromCaches calls completely
According to the JDK's documentation and changelog, the Introspector itself safely handles weak references as of JDK 6 update 21 (which is what we require for Spring 4.0).

Issue: SPR-11356
2014-01-24 18:22:11 +01:00
Juergen Hoeller 8543b91c50 Introduced SpringProperties class and optional "spring.properties" file
This in particular allows for specifying "spring.getenv.ignore" and "spring.beaninfo.ignore" in a local way within the application, in case that JVM-level system properties are locked.

Issue: SPR-9014
Issue: SPR-11297
2014-01-24 16:22:02 +01:00
Juergen Hoeller 8d304efad1 Preserve visitBeanDefinition stacktrace in BeanDefinitionStoreException
Issue: SPR-11346
(cherry picked from commit fdd31c0)
2014-01-23 00:10:07 +01:00
Juergen Hoeller a599b57a74 Revised RootBeanDefinition's externallyManaged* Sets to rely on postProcessingLock
This allows us to avoid early initialization of footprint-heavy ConcurrentHashMaps, and reuses the existing postProcessingLock which will typically be active already when registerExternallyManaged* calls come in from the bean factory's post-processing phase.

Issue: SPR-11343
2014-01-22 14:20:33 +01:00
Juergen Hoeller 799c6a63ec Fixed version number in xsd comment 2014-01-16 11:19:14 +01:00
Juergen Hoeller e670f4e5c6 Polishing 2014-01-15 17:45:04 +01:00
Juergen Hoeller 961f42bd43 Introduced "spring.getenv.ignore" system property for preventing System.getenv calls
Issue: SPR-11297
2014-01-15 17:44:17 +01:00
Juergen Hoeller 240819f955 Introduced "spring.beaninfo.ignore" system property for optimized Introspector usage
Issue: SPR-9014
(cherry picked from commit f88cbda)
2014-01-03 16:39:34 +01:00
Juergen Hoeller f9e8eb59e1 Fixed hasUnresolvableGenerics() to return false in case of an unresolvable bounded variable as well
Issue: SPR-11250
2013-12-20 16:44:25 +01:00
Juergen Hoeller b1460742c3 InjectionMetadata caching per bean name needs to refresh when bean class changes
Issue: SPR-11246
2013-12-19 23:49:31 +01:00
Juergen Hoeller cb682cd8b7 Revised BeanInfoFactory javadoc
Issue: SPR-9014
2013-12-19 15:10:27 +01:00
Juergen Hoeller 8a3b4c69c8 Fixed primitive type assignability in BeanUtils.copyProperties
Issue: SPR-11231
2013-12-16 20:18:37 +01:00
Juergen Hoeller a3a43448d1 Polishing 2013-12-11 23:56:39 +01:00
Juergen Hoeller 106a973a4d Prevent early FactoryBean creation for type checking purposes when coming from a factory method on yet another bean (e.g. from a configuration class)
Issue: SPR-11202
2013-12-11 22:57:22 +01:00
Juergen Hoeller bc5affa79a Made BeanUtils.copyProperties defensive about property type mismatches
Issue: SPR-11209
2013-12-11 20:49:18 +01:00
Juergen Hoeller 1b4e02b178 RequiredAnnotationBeanPostProcessor skips factory-bean definitions
Also moving the associated unit tests to the correct package beans.factory.annotation

Issue: SPR-10458
2013-12-11 16:11:16 +01:00
Juergen Hoeller 62ea627965 Revised exclusion of java.lang.Class properties
Issue: SPR-11098
2013-12-11 11:58:46 +01:00
Juergen Hoeller cb624e25c5 Fixed ExtendedBeanInfo and its tests to accept JDK 8 b117+ introspection results
Specifically, read and write methods are allowed to express property types with superclass/subclass relationships in both directions now.

Issue: SPR-11139
2013-12-10 22:34:17 +01:00
Juergen Hoeller eb1b3c5a68 Use bean-creating factory's AutowireCandidateResolver even for dependencies in parent factory
Specifically, if the current factory has Qualifier/ContextAnnotationAutowireCandidateResolver set up, it is important to pass it on to ancestor factories to get consistent qualifier matching results.

Issue: SPR-10966
2013-12-10 15:33:57 +01:00
Juergen Hoeller be63c07b2e Polishing 2013-12-10 13:26:52 +01:00
Juergen Hoeller 242ecdc448 Fixed inner bean name determination for multi-level nesting scenario, calculating a unique bean name as early as possible now (and for any kind of bean scope)
Our per-bean caching in AutowiredAnnotationBeanPostProcessor and co relies on unique bean names, so this change fixes potential cache mismatch problems occuring there.

Issue: SPR-11131
2013-12-09 21:45:44 +01:00
Juergen Hoeller 5dcd28761c Fixed type resolution for uninitialized factory-method declaration
Issue: SPR-11112
2013-12-09 18:53:27 +01:00
Juergen Hoeller 6078c27e60 Fixed evaluation of "!" operator in case of multiple profile expressions
Issue: SPR-11093
2013-12-09 13:29:21 +01:00
Juergen Hoeller 8580d2d19e Fixed detection of generic types and qualifier annotations on scoped-proxy factory methods
Issue: SPR-11116
2013-12-08 23:24:16 +01:00
Phillip Webb c2b56c07e5 Cache property TypeDescriptors
Attempt to improve performance by caching TypeDescriptors against bean
PropertyDescriptors in CachedIntrospectionResults.

This change is an attempt to fix the failing performance test case
`testPrototypeCreationWithOverriddenResourcePropertiesIsFastEnough` in
`AnnotationProcessorPerformanceTests`.
2013-12-02 21:55:00 -08:00
Juergen Hoeller bd8469990d Detect depends-on cycles and throw proper exception
Issue: SPR-7966
2013-12-02 12:39:37 +01:00
Phillip Webb 043a41e382 Consistent whitespace after imports
Update code to have a consistent number of new-line characters after
import statements.
2013-11-26 15:14:43 -08:00
Phillip Webb 15698860e1 General polish of new 4.0 classes
Apply consistent styling to new classes introduced in Spring 4.0.

- Javadoc line wrapping, whitespace and formatting
- General code whitespace
- Consistent Assert.notNull messages
2013-11-26 15:11:18 -08:00
Phillip Webb a31ac882c5 Fix various javadoc warnings 2013-11-26 13:25:37 -08:00
Eric Dahl e9f78f6043 Fix various typos
Fix a variety of typos throughout the project, primarily in
comments (javadoc or otherwise) but also in a handful of log messages
and a couple exception messages.

ISSUE: SPR-11123
2013-11-25 15:58:27 -08:00
Phillip Webb 59002f2456 Fix remaining compiler warnings
Fix remaining Java compiler warnings, mainly around missing
generics or deprecated code.

Also add the `-Werror` compiler option to ensure that any future
warnings will fail the build.

Issue: SPR-11064
2013-11-25 12:52:42 -08:00
Sam Brannen e910326bf7 Polish Javadoc for ListableBeanFactory 2013-11-17 14:59:47 +00:00
Juergen Hoeller 54571bf038 Introduced getBeanNamesForAnnotation method on ListableBeanFactory
Issue: SPR-11069
2013-11-15 16:04:11 +01:00
Juergen Hoeller b093b84954 Use non-lenient constructor resolution mode for @Bean methods
Since @Bean methods are never used with externally specified constructor argument values but rather just with autowiring, the non-lenient constructor resolution mode is appropriate in case of an overloaded @Bean method, not performing any type difference weight checks. This change includes a refinement of Spring's existing non-lenient constructor resolution (which needs to be explicitly turned on and is therefore not well tested), narrowing the conditions for the ambiguity check (only in case of the same number of arguments and not for overridden methods).

Issue: SPR-10988
2013-11-04 00:19:55 +01:00
Juergen Hoeller 44dee37130 Added further author tags
Issue: SPR-1528
2013-11-01 22:43:02 +01:00
Juergen Hoeller 6e418fe43d QualifierAnnotationAutowireCandidateResolver matches regular bean name for FactoryBean dependency type as well 2013-10-31 15:26:10 +01:00
Juergen Hoeller 3402628a74 Polishing 2013-10-30 22:06:51 +01:00
Juergen Hoeller 148f8f011d AutowireCandidateResolver receives original bean name (including FactoryBean prefix if applicable) for correct generic type check in case of a FactoryBean definition
Issue: SPR-11045
2013-10-30 22:05:33 +01:00
Juergen Hoeller f9584184ef Allow for specific instance-based match to override factory method signature match
Issue: SPR-11046
2013-10-30 22:02:04 +01:00
Juergen Hoeller 8c1767e223 Defensive handling of exceptions during factory method type checking
Also using ClassUtils.forName in AutowireUtils now in order to accept all common class name formats.

Issue: SPR-11034
2013-10-28 13:25:45 +01:00
Juergen Hoeller 56dfcd153e Aligned with refinements in 3.2.x branch
Issue: SPR-11034
2013-10-27 23:17:47 +01:00
Juergen Hoeller 2c2ed7edd3 Polishing 2013-10-27 21:26:16 +01:00
Juergen Hoeller 960ba379ca Fixed resolveReturnTypeForFactoryMethod to unwrap TypedStringValue
XML-defined arguments values are initially turned into TypedStringValue wrappers. If we encounter an unresolved argument, we need to unwrap such a TypedStringValue and then try to treat its content as a class name.

Issue: SPR-11034
2013-10-27 21:26:04 +01:00
Juergen Hoeller 671fad3cb5 Added further tests for raw matching of generic types
Issue: SPR-11034
Issue: SPR-11004
2013-10-27 11:02:16 +01:00
Juergen Hoeller 4cb453bbdc Polishing 2013-10-27 01:21:55 +02:00
Juergen Hoeller a6b0261000 Proper matching of raw generic types and generically typed factory methods
Also optimized getTypeForFactoryMethod's implementation for non-generic factory methods, and reduced calls to getResolvedFactoryMethod in order to avoid repeated synchronization.

Issue: SPR-11034
2013-10-27 00:35:36 +02:00
Juergen Hoeller 2d91309fdf Fixed detection of setter in case of getter with covariant return type narrowing
Issue: SPR-10995
(cherry picked from commit 045f78e)
2013-10-26 17:36:50 +02:00
Juergen Hoeller b32451ac9f Polishing 2013-10-26 15:18:34 +02:00
Juergen Hoeller 614387fe0e Sneaked in test for covariant return type narrowing in a getter method
Issue: SPR-10995
2013-10-26 15:14:31 +02:00
Juergen Hoeller 109faaced8 Factory method type resolution works with indexed and named arguments as well
Issue: SPR-11019
2013-10-26 14:05:37 +02:00
Juergen Hoeller 4675bc4e0c Cache InjectionMetadata per bean name instead of per Class, if possible
Issue: SPR-11027
2013-10-26 14:03:11 +02:00
Juergen Hoeller 393cfcff40 Cache InjectionMetadata per bean name instead of per Class
Issue: SPR-11027
2013-10-26 02:21:38 +02:00
Juergen Hoeller 0851766738 Accept non-generic type match as a fallback
DefaultListableBeanFactory performs a fallback check for autowire candidates now, which GenericTypeAwareAutowireCandidateResolver implements to accept raw type matches if the target class has unresolvable type variables. Full generic matches are still preferred; the BeanFactory will only start looking for fallback matches if the first pass led to an empty result.

Issue: SPR-10993
Issue: SPR-11004
2013-10-25 17:52:38 +02:00
Phillip Webb c9aace4da2 Skip convert to Object from TypeConverterDelegate
Update TypeConverterDelegate to bypass conversion when the target type
is Object.class. Prior to this commit converting a single element array
to an Object would result in the element being returned, rather than
the array itself.

Issue: SPR-10996
2013-10-18 17:19:41 -07:00
Juergen Hoeller 8d6406bbae Groovy-based bean definitions
Formerly known as the Grails BeanBuilder, now in Spring proper. Based on https://github.com/spring-projects/spring-framework/pull/355 but heavily refactored and restructured.

Issue: SPR-7123
2013-10-17 19:24:08 +02:00
Juergen Hoeller bb8cf277fb Polishing 2013-10-17 19:23:51 +02:00
Sam Brannen 8fdc7d4e8f Polish type prediction for generic factory methods
- Now avoiding NullPointerExceptions in GenericTypeResolver's
   resolveReturnTypeForGenericMethod() in case the supplied ClassLoader
   is null.
 - AutowireUtils.resolveReturnTypeForFactoryMethod() now properly
   asserts that the supplied ClassLoader is not null.
 - Fixed copy-n-paste errors in Javadoc for
   AutowireUtils.resolveReturnTypeForFactoryMethod().

Issue: SPR-10411
2013-10-15 15:21:47 +02:00
Juergen Hoeller 3bd6dfe047 Autowiring of generic types
Includes revisions of MethodParameter and DependencyDescriptor (in particular towards a reference to the containing class). Also refines several ResolvableType method signatures.

Issue: SPR-9965
2013-10-15 00:11:23 +02:00
Juergen Hoeller 8b1927f3ec Fixed type prediction for generic factory methods
We're consistently resolving class names now, and the entire algorithm moved from GenericTypeResolver to the internal AutowireUtils helper in the bean factory package.

Issue: SPR-10411
2013-10-14 23:50:04 +02:00
Juergen Hoeller 4574528a27 Comprehensive update to the framework's TimeZone handling, including a new TimeZoneAwareLocaleContext and a LocaleContextResolver for Spring MVC
A few noteworthy minor changes: LocaleContext.getLocale() may return null in special cases (not by default), which our own accessing classes are able to handle now. If there is a non-null TimeZone user setting, we're exposing it to all collaborating libraries, in particular to JSTL, Velocity and JasperReports. Our JSR-310 and Joda-Time support falls back to checking the general LocaleContext TimeZone now, adapting it to their time zone types, if no more specific setting has been provided. Our DefaultConversionService has TimeZone<->ZoneId converters registered. And finally, we're using a custom parseTimeZoneString method now that doesn't accept the TimeZone.getTimeZone(String) GMT fallback for an invalid time zone id anymore.

Issue: SPR-1528
2013-10-04 23:14:08 +02:00
Juergen Hoeller e213561dac AbstractBeanFactory removes alreadyCreated entry after bean creation failure
Issue: SPR-10896
2013-09-14 07:33:47 +02:00
Sam Brannen e1c16f6292 Polish Javadoc for ZoneIdEditor & TimeZoneEditor 2013-09-07 21:14:36 +02:00
Juergen Hoeller e523152653 Properly handle getMethodDescriptors() null value on IBM JVM
Also internally renaming SimpleNonIndexedPropertyDescriptor to SimplePropertyDescriptor and preferring direct field access wherever possible.

Issue: SPR-10862
(cherry picked from commit 5639aa7)
2013-09-02 20:26:24 +02:00
Juergen Hoeller c664010001 Added conversion support for Java 8's ZoneId class and the 'of' method convention
Issue: SPR-1528
2013-08-29 19:15:22 +02:00
Juergen Hoeller fe8dec912d @Bean methods are allowed to override existing bean definitions with a role other than ROLE_APPLICATION now (e.g. framework-generated default beans)
Also, DefaultListableBeanFactory logs a warning when overriding an application definition with a framework-generated definition now, which is expected to be an accident.

Issue: SPR-10607
2013-08-28 22:14:34 +02:00
Juergen Hoeller 4447248a83 Introduced support for @Lazy on injection points
This turned into a rather huge affair since it led to the introduction of a new AutowireCandidateResolver implementation in the spring-context module. That ACR impl is now being set through AnnotationConfigUtils; GenericApplicationContext and co do not set a default QualifierAnnotationAutowireCandidateResolver anymore (which has always been a smell anyway).  At the same time, dependency ordering has moved from AutowiredAnnotationBeanPostProcessor to DefaultListableBeanFactory itself through a "dependencyComparator" strategy, applying to constructor dependencies and lazy resolution proxies as well.

Issue: SPR-10353
2013-08-28 00:14:39 +02:00
Juergen Hoeller 091712df06 Consistent use of Class<?> 2013-08-28 00:03:58 +02:00
Juergen Hoeller 1e64eed6b2 Reintroducing deprecated addConstructorArg variant
Still used by Spring Security 2.0.x's NamespaceHandler etc.
2013-08-27 23:29:41 +02:00
Juergen Hoeller 3d462b6dd9 Added missing spring.schemas entries for 4.0 xsds
Also fixing an old XmlBeanFactory test that relies on "ref local" which is gone in the 4.0 xsd now, redeclaring the affected file to an older xsd version.
2013-08-22 19:36:53 +02:00
Juergen Hoeller 4a9af233ae @Autowired/@Inject with array/List value gets sorted against Ordered/@Order
Issue: SPR-5574
2013-08-22 16:43:10 +02:00
Juergen Hoeller 6d3649858e Allow meta-annotations to override attributes from their parent
Issue: SPR-10181
2013-08-21 17:35:56 +02:00
Juergen Hoeller 1420b970a7 Introduced DefaultParameterNameDiscoverer which checks JDK 8's standard reflection first and then falls back to ASM-based debug symbol analysis
Also, StandardReflectionParameterNameDiscoverer calls "Parameter.isNamePresent()" now to return null (and pass on to the next discoverer) if no JDK 8 parameters are available. Note that this requires OpenJDK 8 b100 or higher to compile now.

Issue: SPR-10532
2013-08-08 15:52:43 +02:00
Juergen Hoeller ec527a4121 Relaxed expectation for JDK bug in cornerSpr8949 (for compatibility with OpenJDK 8 b100)
Issue: SPR-10558
2013-07-30 16:48:09 +02:00
Juergen Hoeller ed996ab4b3 Avoid re-retrieval of singleton bean instances
Issue: SPR-10663
2013-07-30 14:52:22 +02:00
Phillip Webb 1678eaaed0 Turn down logging in DefaultSingletonBeanRegistry
Reduce INFO level destroy logging to DEBUG

Issue: SPR-10758
2013-07-24 13:49:07 -07:00
Phillip Webb b704d62aad Turn down logging in DefaultListableBeanFactory
Reduce INFO level startup logging to DEBUG

Issue: SPR-10758
2013-07-19 13:17:17 -07:00
Phillip Webb 638ba3fa97 Revert inadvertent change to DefaultDocumentLoader
Revert changes to DefaultDocumentLoader accidentally committed in
60532cbd1e.
2013-07-01 07:08:17 -07:00
Phillip Webb 60532cbd1e Polish spring-websocket code
Minor polish to formatting and assertion messages.
2013-06-27 09:58:58 -07:00
Phillip Webb 8ed8ee2dfe Skip abstract beans in getBeansWithAnnotation()
Update BeanFactory.getBeansWithAnnotation() to skip any abstract
bean definitions.

Issue: SPR-10663
2013-06-20 22:48:30 -07:00
Sam Brannen b305f0005b Add test to assess claims in SPR-10411
This commit verifies that the return type of a parameterized instance
factory method is properly resolved.

Issue: SPR-10411
2013-06-09 00:21:58 +02:00
Juergen Hoeller 7e01578515 Avoid unnecessary creation of default StandardEnvironment instances
Issue: SPR-10568
2013-05-15 23:41:32 +02:00
Juergen Hoeller 070103b17e Fixed type detection to avoid reuse of parent bean's targetType on child definition merge
Issue: SPR-10374
2013-05-15 16:41:32 +02:00
Juergen Hoeller 59ef34d769 Polishing 2013-05-14 21:20:24 +02:00
Juergen Hoeller 14617447a6 Consistent use of Class<?> in core container method signatures 2013-05-14 17:44:06 +02:00
Juergen Hoeller bc3e5851b3 Detect a FactoryBean type match even if predictBeanType returned a non-FactoryBean type
This change should be the final piece in the puzzle to let SmartInstantiationAwareBeanPostProcessor's predictBeanType predict a FactoryBean-produced type, effectively as a semantic alternative to its postProcessBeforeInstantiation-related role.

Issue: SPR-10517
2013-05-14 17:43:13 +02:00
Rob Winch 9468548116 Add @Override to remaining source files
Issue: SPR-10130
2013-05-13 17:04:56 -05:00
Juergen Hoeller 2a44228b98 Consistent use of <pre class="code">
Issue: SPR-8108
2013-05-07 21:31:26 +02:00
Juergen Hoeller 2c3a8a5309 Removed parsing support for the 'singleton' attribute in an XML bean definition
Following the introduction of spring-beans-4.0.xsd and the corresponding removal of the pre-2.0 spring-beans.dtd.

Issue: SPR-10437
2013-05-07 18:11:52 +02:00
Juergen Hoeller 0fc5a5d912 Introduced 4.0 versions of all XML configuration schemas
Removed spring-beans.dtd (the 1.x variant) and spring-oxm-1.5.xsd (pre-Spring-Framework variant), in order to raise the backwards compatibility limit a little bit at least. We'll keep supporting the 2.0 and 2.5 xsd versions for the time being, as well as spring-beans-2.0.dtd.

Removed the ref 'local' attribute in spring-beans-4.0.xsd since 'local' lost its differentiating role to a regular bean ref back in the 3.1 days when we started allowing for the same bean id to reappear in a different beans section of the same configuration file (with a different profile).

Issue: SPR-10437
2013-05-07 18:11:51 +02:00
Juergen Hoeller 61c3f3d9fd Removed support for deprecated registerSharedEditor mechanism 2013-05-03 11:49:53 +02:00
Juergen Hoeller 0a8f5b2919 Removed deprecated helper classes and methods (that have been deprecated since 3.0 or before) 2013-05-02 17:25:10 +02:00
Juergen Hoeller 9c09a0a037 Consistent Map/Set ordering
Use LinkedHashMaps/Sets wherever exposed to users, and code tests defensively in terms of expected Map/Set ordering. Otherwise, there'll be runtime order differences between JDK 7 and JDK 8 due to internal HashMap/Set implementation differences.

Issue: SPR-9639
2013-04-23 13:53:09 +02:00
Juergen Hoeller d3a4068768 Minimized ASM usage
In particular, avoid accidental usage of ASM for core JDK types - which will fail in case of a new bytecode version in the JDK, even if the application itself has been compiled with an earlier bytecode target.

Issue: SPR-10292
2013-04-23 13:49:25 +02:00
Sam Brannen cf687fcc72 Fix typos in ServiceLocatorFactoryBean 2013-04-12 14:21:24 +02:00
Juergen Hoeller 853826a774 Use JDK 1.6's Collections.newSetFromMap instead of manually accessing Maps with dummy Boolean values 2013-03-28 22:14:26 +01:00
Juergen Hoeller 23bf5f563b Added "destroyBean(Object)" method to AutowireCapableBeanFactory
Driven by the need for implementing Bean Validation 1.1's "releaseInstance" method in SpringConstraintValidatorFactory, as a direct counterpart to the use of AutowireCapableBeanFactory's "createBean(Class)" in "getInstance".

Issue: SPR-8199
2013-03-28 21:44:07 +01:00
Juergen Hoeller 5472e975f6 Removed deprecated core.enums package 2013-03-19 23:31:50 +01:00
Phillip Webb 4e1cab28df Merge branch '3.2.x'
* 3.2.x: (28 commits)
  Hide 'doc' changes from jdiff reports
  Document @Bean 'lite' mode vs @Configuration
  Final preparations for 3.2.2
  Remove Tiles 3 configuration method
  Polishing
  Extracted buildRequestAttributes template method from FrameworkServlet
  Added "beforeExistingAdvisors" flag to AbstractAdvisingBeanPostProcessor
  Minor refinements along the way of researching static CGLIB callbacks
  Compare Kind references before checking log levels
  Polish Javadoc in RequestAttributes
  Fix copy-n-paste errors in NativeWebRequest
  Fix issue with restoring included attributes
  Add additional test for daylight savings glitch
  Document context hierarchy support in the TCF
  Fix test for daylight savings glitch
  Make the methodParameter field of HandlerMethod final
  Disable AsyncTests in spring-test-mvc
  Reformat the testing chapter
  Document context hierarchy support in the TCF
  Document context hierarchy support in the TCF
  ...
2013-03-13 14:01:46 -07:00
Phillip Webb 85f8d6f695 Merge branch 'cleanup-3.2.x' into 3.2.x
* cleanup-3.2.x:
  Replace EasyMock with Mockito
2013-03-06 11:08:17 -08:00
Phillip Webb 05765d7520 Replace EasyMock with Mockito
Issue: SPR-10126
2013-03-06 11:06:15 -08:00
Chris Beams ce4be3b46b Merge branch '3.2.x' into master
Conflicts:
	gradle.properties
	spring-beans/src/main/java/org/springframework/beans/factory/support/StaticListableBeanFactory.java
	spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheManagerFactoryBean.java
	spring-core/src/main/java/org/springframework/core/convert/support/StringToEnumConverterFactory.java
	spring-core/src/main/java/org/springframework/core/env/ReadOnlySystemAttributesMap.java
	spring-jdbc/src/main/java/org/springframework/jdbc/datasource/LazyConnectionDataSourceProxy.java
	spring-jdbc/src/main/java/org/springframework/jdbc/support/lob/AbstractLobHandler.java
	spring-web/src/main/java/org/springframework/http/client/BufferingClientHttpRequestWrapper.java
	spring-web/src/main/java/org/springframework/http/client/SimpleBufferingClientHttpRequest.java
	spring-web/src/main/java/org/springframework/http/converter/BufferedImageHttpMessageConverter.java
	spring-web/src/main/java/org/springframework/http/converter/FormHttpMessageConverter.java
2013-03-04 15:41:15 +01:00
Juergen Hoeller db823ba1e4 DefaultListableBeanFactory clears by-type matching cache on runtime register/destroySingleton calls
Issue: SPR-10326
2013-03-04 12:29:26 +01:00
Juergen Hoeller c986a1efc1 Cache target type per bean definition and allow for specifying it in advance
Issue: SPR-10335
2013-03-01 16:43:24 +01:00
Juergen Hoeller e0c7571a41 Refined predictBeanType's typesToMatch check for FactoryBeans
GroovyScriptFactoryTests passes again now.

Issue: SPR-10304
2013-03-01 15:52:24 +01:00
Juergen Hoeller 1bae80a241 Polishing 2013-02-27 00:31:05 +01:00
Chris Beams 58ab8b691c Re-enable ignored SecurityManager-related test
Prior to this change, CallbacksSecurityTests#testContainerPrivileges was
@Ignored because it caused the build to fail under Gradle. After some
analysis, the root cause was determined to be the fact that (a) a
restrictive SecurityManager is active during the running of this test,
and (b), Gradle intercepts System.out and routes it through its internal
LogBack-based logging system. LogBack requires a call to
Class#getClassLoader when handling logging statements, and the
SecurityManager disallows this call, thus raising the error that fails
the build.

This commit solves the problem by eliminating the System.out.println
call in question and removing the @Ignore annotation from the test. The
console output was diagnostic in nature anyway, and not required for the
successful execution of the test's assertions.

Issue: SPR-10074
2013-02-26 14:25:57 +01:00
Chris Beams 3100d89d07 Clean up console output for spring-beans tests 2013-02-26 14:21:01 +01:00
Phillip Webb 5008005df0 Protect against 'has not been resolved to a Class'
Update AbstractAutowireCapableBeanFactory.getTypeForFactoryBean to
check AbstractBeanDefinition.hasBeanClass() before calling
getBeanClass(). The protects against a 'Bean class name [<name>] has
not been resolved into an actual Class' IllegalStateException.

Issue: SPR-10304
2013-02-19 09:20:09 -08:00
Phillip Webb 608dab28bf Protect against ArrayIndexOutOfBoundsException
Update logic in AbstractAutowireCapableBeanFactory.predictBeanType to
protect against a ArrayIndexOutOfBoundsException.

Issue: SPR-10304
2013-02-19 09:18:15 -08:00
Phillip Webb 893574be0e Protect against ArrayIndexOutOfBoundsException
Update logic in AbstractAutowireCapableBeanFactory.predictBeanType to
protect against a ArrayIndexOutOfBoundsException.

Issue: SPR-10304
2013-02-15 12:31:47 -08:00
Carson McDonald 6f0b4395e5 Fix a few typos
Minor changes to fix typos. Small adjustment to add a couple commas.
2013-02-12 09:04:28 -05:00
Juergen Hoeller b3c9a11bd1 Folded a FactoryBean-specific check into predictBeanType now
This change means that we effectively revert SPR-8954's code change in favor of the isFactoryBean implementation simply relying on predictBeanType to sort it out, filtering a post-processed predictedType for FactoryBean applicability.

Issue: SPR-9177
Issue: SPR-9143
2013-02-07 23:23:25 +01:00
Juergen Hoeller e3c83bb769 Minor javadoc and source layout polishing 2013-02-07 15:36:19 +01:00
Phillip Webb f464a45ba4 Polish formatting
Minor formatting polish across that codebase. Primarily fixing
whitespace issues.
2013-02-04 10:35:25 -08:00
Phillip Webb d89e30b864 Fix unnecessary @SupressWarnings annotations 2013-01-29 15:37:25 -08:00
Phillip Webb 2b0d860923 Fix Javadoc warnings 2013-01-25 17:31:33 -08:00
Phillip Webb 065b1c0e46 Fix unused local variable warnings 2013-01-25 14:35:19 -08:00
Phillip Webb 6a1e841952 Fix unused type compiler warnings 2013-01-25 14:35:07 -08:00
Phillip Webb 88f5dd6ce1 Fix 'is already an instance of type' warnings 2013-01-25 11:29:54 -08:00
Juergen Hoeller d46a82bbb0 Added note on thread safety to TypeConverter and SimpleTypeConverter javadoc
Issue: SPR-8659
2013-01-24 11:19:06 +01:00
Juergen Hoeller 575926932d Polishing 2013-01-23 22:17:48 +01:00
Juergen Hoeller 4c823a3f9b DisposableBeanAdapter detects "shutdown" as a destroy method as well (for EHCache CacheManager setup)
Issue: SPR-9713
2013-01-23 22:00:34 +01:00
Phillip Webb f3ff98d862 Allow nulls with multiple embedded value resolvers
Allow an embedded value resolver added to an AbstractBeanFactory to
return null without adversely effecting any subsequent resolvers.

Issue: SPR-8565
2013-01-23 11:08:14 -08:00
Phillip Webb 7e74fd2b7f Consider primary attribute with getBean(Class)
Update DefaultListableBeanFactory.getBean(Class<?> beanClass) to
consider the 'primary' attribute of bean definitions. This makes
getBean() behave in the same way as autowiring.

Issue: SPR-7854
2013-01-22 23:30:34 -08:00
Juergen Hoeller 8f103c2ea1 Introduced NoUniqueBeanDefinitionException as a dedicated subclass of NoSuchBeanDefinitionException
Issue: SPR-10194
2013-01-22 21:12:06 +01:00
Juergen Hoeller 1a929f22e0 EntityManagerFactoryUtils finds default EntityManagerFactory in parent contexts as well
Also introduces consistent use of getBean(Class) for similar use cases across the framework, accepting a locally unique target bean even if further matching beans would be available in parent contexts (in contrast to BeanFactoryUtils.beanOfType's behavior).

Issue: SPR-10160
2013-01-22 21:12:05 +01:00
Juergen Hoeller 721fa9db6a SpringBeanAutowiringInterceptor eagerly releases BeanFactory if post-construction fails
Issue: SPR-10013
2013-01-18 14:12:02 +01:00
Juergen Hoeller 6a5744e61c CachedIntrospectionResults.clearClassLoader(null) removes cached classes for the system class loader
Issue: SPR-9189
2013-01-18 13:32:10 +01:00
Chris Beams 26d5ef93e6 Handle non-void write methods deterministically
This change resolves a specific issue with processing
java.math.BigDecimal via ExtendedBeanInfo. BigDecimal has a particular
constellation of #setScale methods that, prior to this change, had the
potential to cause ExtendedBeanInfo to throw an IntrospectionException
depending on the order in which the methods were processed.

Because JDK 7 no longer returns deterministic results from
Class#getDeclaredMethods, it became a genuine possibility - indeed a
statistical certainty that the 'wrong' setScale method handling order
happens sooner or later. Typically one could observe this failure once
out of every four test runs.

This commit introduces deterministic method ordering of all discovered
non-void returning write methods in such a way that solves the problem
for BigDecimal as well as for any other class having a similar method
arrangement.

Also:

 - Remove unnecessary cast

 - Pass no method information to PropertyDescriptor superclasses when
   invoking super(...). This ensures that any 'type mismatch'
   IntrospectionExceptions are handled locally in ExtendedBeanInfo and
   its Simple* PropertyDescriptor variants where we have full control.

Issue: SPR-10111, SPR-9702
Backport-Commit: aa3e0be (forward-ported via cherry-pick from 3.1.x)
2013-01-16 08:11:55 +01:00
Chris Beams 42729014b6 Move namespace tests to root integration module
Prior to this change, spring-beans contained its own META-INF containing
spring.handlers and spring.schemas files in src/main/resources; it also
had files of the same name within src/test/resources/META-INF, causing
'duplicate resource' warnings and confusion in general.

This commit moves the com.foo test package, it's associated namespace
parsing tests and test versions of META-INF files to the root project
and it's src/test integration testing folder.

Issue: SPR-9431
2013-01-04 12:16:20 +01:00
Chris Beams 51b307681a Fix warnings due to unused import statements
Issue: SPR-9431
2013-01-04 11:04:54 +01:00
Chris Beams b836e14b5f Merge branch 'cleanup-test-duplicates' into cleanup-3.2.x
* cleanup-test-duplicates:
  Update Apache license headers for affected sources
  Remove duplicate test classes
  Replace test beans with test objects

Conflicts:
	spring-beans/src/test/java/org/springframework/beans/factory/ConcurrentBeanFactoryTests.java
	spring-beans/src/test/java/org/springframework/beans/support/PagedListHolderTests.java
2013-01-04 10:31:31 +01:00
Phillip Webb 42b5d6dd7e Remove duplicate test classes
Prior to this commit many test utility classes and sample beans were
duplicated across projects. This was previously necessary due to the
fact that dependent test sources were not shared during a gradle
build. Since the introduction of the 'test-source-set-dependencies'
gradle plugin this is no longer the case.

This commit attempts to remove as much duplicate code as possible,
co-locating test utilities and beans in the most suitable project.
For example, test beans are now located in the 'spring-beans'
project.

Some of the duplicated code had started to drift apart when
modifications made in one project where not ported to others. All
changes have now been consolidated and when necessary existing tests
have been refactored to account for the differences.

Conflicts:
	spring-beans/src/test/java/org/springframework/beans/factory/ConcurrentBeanFactoryTests.java
	spring-beans/src/test/java/org/springframework/beans/factory/support/BeanFactoryGenericsTests.java
	spring-beans/src/test/java/org/springframework/beans/support/PagedListHolderTests.java
2013-01-04 10:02:29 +01:00
Chris Beams 7a737bebdd Merge branch '3.2.x' into master
* 3.2.x:
  Fix ClassCastException when setting media types
  Enable execution of TestNG tests in spring-test
  Polish support for topic branch-specific versions
  Segregate add'l long-running and performance tests
  Eliminate EBR dependencies and repository config
  Skip creation of IDEA metadata for spring-aspects
  Fix Eclipse compilation error in Gradle plugin
  Polish build.gradle
  Fix null parameterName issue in content negotiation
  Recursively add test dependencies
2013-01-03 22:31:52 +01:00
Chris Beams 68e3b7773c Segregate add'l long-running and performance tests
- Add TestGroup#LONG_RUNNING to distinguish from #PERFORMANCE, the
   former being tests that simply take a long time vs the latter being
   tests that are actually dependent on certain actions happening within
   a given time window and are thefore CPU-dependent.

Issue: SPR-9984
2013-01-03 19:28:05 +01:00
Chris Beams 961dbdb68a Merge branch '3.2.x' into master
* 3.2.x:
  Exclude spring-build-src from maven publish
  Move spring-build-junit into spring-core
  Relocate MergePlugin package
  Develop a gradle plugin to add test dependencies
  Expose Gradle buildSrc for IDE support
  Fix [deprecation] compiler warnings
  Upgrade to xmlunit version 1.3
  Improve 'build' folder ignores
  Fix regression in static setter method support
  Fix SpEL JavaBean compliance for setters

Conflicts:
	spring-beans/src/test/java/org/springframework/beans/ExtendedBeanInfoTests.java
2013-01-02 10:36:57 +01:00
Chris Beams 70eaf02b7f Revert "Merge branch 'SPR-10130' into cleanup-master"
This reverts commit 45fa50821a, reversing
changes made to a312d900f8.
2013-01-02 10:33:59 +01:00
Phillip Webb 65fb26f847 Move spring-build-junit into spring-core
Move code from spring-build-junit into spring-core/src/test along with
several other test utility classes. This commit removes the temporary
spring-build-junit project introduced in commit
b083bbdec7.
2013-01-01 19:49:45 -08:00
Phillip Webb 6626a38730 Fix [deprecation] compiler warnings
Fix deprecation compiler warnings by refactoring code or applying
@SuppressWarnings("deprecation") annotations. JUnit tests of
internally deprecated classes are now themselves marked as
@Deprecated.

Numerous EasyMock deprecation warnings will remain until the
migration to mockito can be completed.
2013-01-01 13:42:15 -08:00
Chris Beams 7a19fd5750 Fix regression in static setter method support
The intention of ExtendedBeanInfo, introduced with SPR-8079 in
v3.1.0.M2, was to support dependency injection against non-void
returning write methods. However, it also inadvertently introduced
support for injection against static setter methods.

When use of ExtendedBeanInfo was made optional with SPR-9723 in
v3.2.0.M2, ExtendedBeanInfo continued to support static write methods,
but its new BeanInfoFactory-based approach to testing whether or not
a given bean class contains candidate write methods was written in a
fashion exclusive of static methods, and this thereby introduced a
regression - a regression in an otherwise undocumented and unintended
feature, but a regression nevertheless.

The reporting of SPR-10115 proves that at least one user has come to
depend on this behavior allowing injection against static write
methods, and so this commit fixes the regression by ensuring that the
candidacy test includes standard and non-void setter methods having a
static modifier.

Issue: SPR-10115, SPR-9723, SPR-8079
2012-12-31 14:16:38 +01:00
Chris Beams b2a048b6f3 Update Apache license headers for affected sources 2012-12-28 23:57:33 +01:00
Chris Beams 3b40ce76bf Add @Override annotations to main sources
Issue: SPR-10130
2012-12-28 23:53:24 +01:00
Chris Beams a312d900f8 Merge branch 'cleanup-3.2.x' into cleanup-master
* cleanup-3.2.x: (33 commits)
  Update Apache license headers for affected sources
  Ignore performance-sensitive tests by default
  Introduce 'spring-build-junit' subproject
  Replace EasyMock with Mockito in test sources
  Add @Override annotations to test sources
  Update test source and target JDK compatibility
  Update -Xlint compiler warning output
  Fix various compiler warnings in spring-context
  Fix "unnecessary @SuppressWarnings" warnings
  Fix [rawtypes] compiler warnings
  Fix [dep-ann] warnings with @Deprecated
  Fix [cast] compiler warnings
  Fix [serial] compiler warnings
  Fix [varargs] compiler warnings
  Fix warnings due to unused import statements
  Replace <code> with {@code} throughout Javadoc
  Fix various Javadoc warnings
  Replace space indentation with tabs
  Remove trailing whitespace in source files
  Various updates to support IDEA
  ...

Conflicts:
	gradle.properties
2012-12-28 23:26:59 +01:00
Chris Beams 8472a2b2ab Update Apache license headers for affected sources 2012-12-28 23:09:31 +01:00
Phillip Webb 60032e0012 Ignore performance-sensitive tests by default
Make use of the new JUnit functionality introduced in the previous
commit to 'Assume' that perfomance- and timing-sensitive tests should
run only when TestGroup.PERFORMANCE is selected, i.e. when
-PtestGroups="performance" has been provided at the Gradle command line.

The net effect is that these tests are now ignored by default, which
will result in far fewer false-negative CI build failures due to
resource contention and other external factors that cause slowdowns.

We will set up a dedicated performance CI build to run these tests on
an isolated machine, etc.

Issue: SPR-9984
2012-12-28 23:08:37 +01:00
Phillip Webb d66c733ef4 Replace EasyMock with Mockito in test sources
Issue: SPR-10126
2012-12-28 23:07:04 +01:00
Chris Beams 4c8cd7b0bd Add @Override annotations to test sources
Issue: SPR-10129
2012-12-28 23:05:44 +01:00
Chris Beams 4d97ff2479 Fix [dep-ann] warnings with @Deprecated 2012-12-28 22:50:45 +01:00
Phillip Webb 6c14eaad61 Fix [cast] compiler warnings 2012-12-28 22:41:06 +01:00
Phillip Webb b0986049a3 Fix [serial] compiler warnings
Fix serialization warnings by applying @SuppressWarnings("serial")
when appropriate.

In certain cases and for unknown reasons, a correctly-placed
@SuppressWarnings("serial") annotation will fix the warning at the
javac level (i.e. the Gradle command-line), but will produce an
"unnecessary @SuppressWarnings" warning within Eclipse. In these
cases, a private static final serialVersionUID field has been added
with the default value of 1L.
2012-12-28 22:41:06 +01:00
Phillip Webb 7f0aa5cfb2 Fix [varargs] compiler warnings
Remove unnecessary 'null' argument from calls to vararg supported
methods and fix cast in ValidationUtils.invokeValidator().
2012-12-28 22:40:49 +01:00
Phillip Webb 731d5be644 Fix warnings due to unused import statements 2012-12-28 22:40:49 +01:00