Commit Graph

1091 Commits

Author SHA1 Message Date
Juergen Hoeller b2b0df893a Merge branch '5.1.x' 2019-03-05 14:20:02 +01:00
Juergen Hoeller 013c0bca92 Polishing 2019-03-05 13:08:11 +01:00
Sam Brannen 70cf597484 Remove obsolete overview.html files 2019-03-04 14:07:48 +01:00
Sam Brannen d4f544d42f Add missing precondition check to AutowireUtils.resolveDependency
See gh-2060
2019-03-02 14:39:43 +01:00
Juergen Hoeller fc7948c96b Merge branch '5.1.x' 2019-02-27 17:34:46 +01:00
Juergen Hoeller e583da0725 Polishing 2019-02-27 17:26:53 +01:00
Juergen Hoeller 0288878bcc Consistent handling of early FactoryBean instantiation failures
Closes gh-22409
2019-02-27 17:26:35 +01:00
Sam Brannen f2a5415111 Fix CheckStyle violations
See gh-2060
2019-02-27 16:41:00 +01:00
Sam Brannen 6f6be27aae Polish AutowireUtils[Tests]
See gh-2060
2019-02-27 16:25:34 +01:00
Loïc Ledoyen d77b36bf3b Open parameter autowiring utility for external use (#2060)
* Make AutowireUtils public and protect its current API
* Move ParameterAutowireUtils features to AutowireUtils

Closes gh-2060
2019-02-27 15:15:45 +01:00
Sam Brannen 3a42f1154d Polishing 2019-02-27 14:03:11 +01:00
Juergen Hoeller 3a641d9297 Merge branch '5.1.x' 2019-02-26 17:50:35 +01:00
Juergen Hoeller 490b23518b Polishing 2019-02-26 17:42:49 +01:00
stsypanov 5e29ea30a3 Use StringJoiner where possible to simplify String joining 2019-02-15 14:55:35 +01:00
Juergen Hoeller 7cde283066 Merge branch '5.1.x' 2019-02-07 23:07:22 +01:00
Juergen Hoeller 15af0d9787 Polishing 2019-02-07 23:02:35 +01:00
Juergen Hoeller 0b617a8c93 Deprecate PreferencesPlaceholderConfigurer along with its base class
Also removing common PropertyPlaceholderConfigurer doc references.

See gh-22181
2019-02-07 16:53:05 +01:00
Juergen Hoeller d25783329a Merge branch '5.1.x' 2019-02-07 16:01:14 +01:00
Juergen Hoeller e9626779ee @Resource provides dependency descriptor for resolving beans by name
Closes gh-22359
2019-02-07 15:56:00 +01:00
Sebastien Deleuze 72ed274c6f Merge branch '5.1.x' 2019-02-06 19:35:20 +01:00
Sebastien Deleuze d1e5a3af9f Fix truncated Value#value javadoc
Closes gh-22331
2019-02-06 19:28:31 +01:00
Sebastien Deleuze 3787b23a98 Deprecate PropertyPlaceholderConfigurer
This commit deprecates PropertyPlaceholderConfigurer in favor of
PropertySourcesPlaceholderConfigurer.

Closes gh-22181
2019-02-06 16:00:24 +01:00
Sebastien Deleuze 0b9522c84e Migrate Kotlin Mockito tests to Mockk
Closes gh-22345
2019-02-05 15:47:08 +01:00
Juergen Hoeller ca7634dfe8 Avoid duplicate class introspection during findAnnotationOnBean
Closes gh-22318
2019-02-05 00:42:24 +01:00
Sam Brannen 0742986e0e Suppress warnings from tests in Gradle build 2019-02-01 11:13:53 +01:00
Johnny Lim 963cc09c2e Polish AutowireUtils.EXECUTABLE_COMPARATOR
Closes gh-22283
2019-01-20 17:37:46 +01:00
Juergen Hoeller 605e2477b9 Polishing 2019-01-08 21:57:13 +01:00
Juergen Hoeller f56fa91430 Polishing 2019-01-08 17:11:34 +01:00
Juergen Hoeller 9cb5369cb9 DependencyDescriptor supports TypeDescriptor resolution for fields
This allows for proper nested type conversion in @Value Optional fields analogous to method parameters, through a new TypeDescriptor-based method in the TypeConverter SPI. As an additional and less involved measure that is worth backporting, DefaultListableBeanFactory defensively checks for pre-converted Optional wrappers.

Issue: SPR-17607
2019-01-08 17:11:27 +01:00
Michel Schudel 4938dab0ae Fix XML parser default value handling
The xml parser does not fill in defaults provided in the XSD when
validation is disabled. As a result, attributes like default-lazy-init
will not receive the value "default" but an empty string.

With this commit, BeanDefinitionParserDelegate now takes this into
account, checking default values against empty string as well as
"default".

As a consequence, default-lazy-init attribute should now work correctly
even when the XSD validation is disabled.

Issue: SPR-8335
2019-01-08 15:36:01 +01:00
Stephane Nicoll b83ceab88a Polish "Refactor duplicate code"
Closes gh-1452
2018-12-21 15:07:09 +01:00
diguage c15bbd675f Refactor duplicate code
See gh-1452
2018-12-21 15:06:56 +01:00
igor-suhorukov 93189a6733 String.indexOf() expressions can be replaced with a call to the String.contains() method available in Java 5 and newer. 2018-12-13 12:29:31 +01:00
Rossen Stoyanchev 38ae282c3b Update log category precision for all tests
Replace the full category capped at 36 chars with the class name only
and 1 char per package, e.g. org.apache.commons.Foo -> o.a.c.Foo
2018-12-12 11:40:33 -05:00
Juergen Hoeller ebbe14c363 ResolvableType-based matching consistently respects generic factory method return type (even for pre-initialized raw singleton instance)
Issue: SPR-17524
2018-11-25 21:27:19 +01:00
Juergen Hoeller bf272b0b21 Nullability fine-tuning based on IntelliJ IDEA 2018.3 inspection
Issue: SPR-15540
2018-11-22 16:12:38 +01:00
Juergen Hoeller f5aeb81473 SerializedBeanFactoryReference falls back to dummy with specific id
Issue: SPR-17508
2018-11-20 22:02:10 +01:00
Hanope bfb49c7249 Fix typos
See gh-2019
2018-11-19 08:41:21 +01:00
Juergen Hoeller 40148c0560 Consistent use of ResolvableType.toClass() for assignability checks
Issue: SPR-17086
2018-11-12 20:29:37 +01:00
Juergen Hoeller 5cd525a2b0 Enforce use of ClassLoader.loadClass in case of temporary ClassLoader
Issue: SPR-17452
2018-11-05 17:44:46 +01:00
Juergen Hoeller f32e1bcbe3 Polishing 2018-10-26 11:07:29 +02:00
Juergen Hoeller da23505e94 Clarify FactoryBean initialization effect in getBeanNamesForAnnotation
Issue: SPR-17392
2018-10-18 18:04:04 +02:00
Juergen Hoeller 309e70a48e Separate factory method cache for introspection purposes
Issue: SPR-17358
Issue: SPR-8891
2018-10-12 22:53:50 +02:00
Juergen Hoeller c89e3e6e0d Restore original factory method caching (addressing Boot regressions)
Issue: SPR-17358
2018-10-10 23:53:13 +02:00
Juergen Hoeller 053820c4ff Polishing 2018-10-09 23:14:49 +02:00
Juergen Hoeller f662e3b85e BeanFactoryAnnotationUtils provides qualifiedBeansOfType method
Includes consistent upfront resolution of factory method annotations.

Issue: SPR-8891
2018-10-09 23:14:27 +02:00
Juergen Hoeller 44afed426a ObjectProvider stream consistently includes beans from parent context
Issue: SPR-17356
2018-10-09 23:14:19 +02:00
www 9d5aced8c5 Fix formatting
Prefix the opening brace with a single space in some classes.
Replace tab character with space in javadoc of AttributeAccessor.
Also fix some other trivial formatting errors.

Closes gh-1979
2018-10-05 09:20:47 +02:00
Juergen Hoeller 2ec41c8153 Polishing 2018-09-29 18:57:56 +02:00
Juergen Hoeller 333e327289 Revised javadoc for up-to-date constructor autowiring semantics
Issue: SPR-17299
2018-09-29 17:09:30 +02:00
Juergen Hoeller 75627617c9 Ordered streams consistently operate on resolved bean instances
Issue: SPR-17272
2018-09-20 11:31:42 +02:00
Juergen Hoeller b6b880ce27 Polishing 2018-09-19 23:05:40 +02:00
Juergen Hoeller 082c524cbe Polishing 2018-09-19 22:19:49 +02:00
Juergen Hoeller d3c08552e9 Revisit GenericApplicationContext.registerBean constructor handling
Support for Kotlin primary constructor and non-default public constructors in addition to default instantiation, aligned with AnnotationConfigApplicationContext and model attribute processing.

Issue: SPR-17292
2018-09-19 22:19:43 +02:00
Juergen Hoeller 1756f83701 Defensively expect concurrent registration of BeanPostProcessors
Declaring beanPostProcessors (and also embeddedValueResolvers) as CopyOnWriteArrayList prevents ConcurrentModificationExceptions in case of concurrent registration/access attempts.

Issue: SPR-17286
2018-09-18 21:25:36 +02:00
Juergen Hoeller 65ca7f4909 Polishing 2018-09-18 17:19:37 +02:00
Juergen Hoeller c634b2fae7 ResolvableType-based resolution uses BeanNamesByType cache if possible
Issue: SPR-17282
2018-09-18 15:30:43 +02:00
Juergen Hoeller 8e83f140d4 Polishing 2018-09-15 00:17:17 +02:00
Juergen Hoeller 41d4cb5cbf Ordered stream access on ObjectProvider with strong order guarantees
Issue: SPR-17272
2018-09-14 23:56:25 +02:00
Juergen Hoeller 97cea7f36e BeanDefinition interface exposes initMethodName and destroyMethodName
Also includes setters for role and description.

Issue: SPR-17275
2018-09-13 20:24:36 +02:00
Juergen Hoeller 65c8fa400f Consistent ordered list access and lazy streaming for ObjectProvider
Includes fallback match for collection/map dependency if qualified.

Issue: SPR-17272
Issue: SPR-17197
2018-09-13 18:23:19 +02:00
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