Commit Graph

1601 Commits

Author SHA1 Message Date
Juergen Hoeller 78681c6369 JndiRmiServiceExporter still calls PortableRemoteObject when available
Issue: SPR-16670
2018-03-30 15:19:38 +02: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 e6020ed377 avoid unnecessary autoboxing 2018-03-28 23:48:12 +02:00
Stephane Nicoll d1a0b8d53f Clarify the format supported by @PropertySource
Issue: SPR-16563
2018-03-28 11:03:53 +02:00
igor-suhorukov 4aae6a6dda Use Map.forEach instead of manual Map.Entry iteration wherever possible SPR-16646 2018-03-28 01:09:03 +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 8d5587fe4f Consistent thread-safe iteration in DefaultSingletonBeanRegistry
Issue: SPR-16620
2018-03-24 16:30:51 +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 99399084a6 Consistent Future check (even if typically encountering RunnableFuture)
Issue: SPR-16607
2018-03-19 12:42:49 +01:00
Juergen Hoeller 3c1adf7f6a ThreadPoolTaskExecutor/Scheduler cancels remaining Futures on shutdown
Issue: SPR-16607
2018-03-19 01:45:22 +01:00
Juergen Hoeller 4fef1fe820 Polishing 2018-03-16 18:49:12 +01:00
Juergen Hoeller 914b2470dc Scope annotation in class hierarchies vs XML bean definition inheritance
Issue: SPR-16602
2018-03-16 18:49:00 +01:00
Juergen Hoeller c4e9ce8d0e Clarified repeatable PropertySource annotation vs use as meta-annotation
Issue: SPR-16592
2018-03-14 18:53:50 +01:00
Juergen Hoeller 3988dd9ebb Polishing 2018-03-14 17:24:58 +01:00
Stephane Nicoll cc12afdea2 Add support for deferred import selector group
This commit allows several DeferredImportSelector instances to be
grouped and managed in a centralized fashion. This typically allows
different instances to provide a consistent ordered set of imports to
apply.

Issue: SPR-16589
2018-03-13 16:52:26 -04:00
Juergen Hoeller 04a8f81710 Polishing 2018-03-12 20:42:03 +01:00
Juergen Hoeller 50e980c02f Validate declared annotations before deciding between reflection and ASM
Issue: SPR-16564
2018-03-12 13:40:26 +01:00
Stephane Nicoll fb7c4a3066 Polish 2018-03-11 10:26:41 +01:00
igor-suhorukov 6163f2d32f use more modern java API for empty collections 2018-03-08 21:41:57 +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
Sam Brannen 0f5a3e2647 Polish formatting in Groovy scripts 2018-03-07 16:09:04 +01:00
Sam Brannen df0b39e8ac Add missing packages to Groovy scripts 2018-03-07 16:09:03 +01:00
Juergen Hoeller f57fcdee3c Polishing 2018-03-07 15:49:58 +01:00
igor-suhorukov 129530f792 Polish
Closes gh-1715
2018-03-03 12:12:15 +01:00
igor-suhorukov ed936cbd89 Polish: Overriding methods should do more than simply call the same method in the super class 2018-03-02 00:06:27 +01:00
Juergen Hoeller 33cd160861 Upgrade to Reactor Bismuth SR7, Hibernate ORM 5.2.14, Common Annotations 1.3.2 2018-02-28 14:01:04 +01:00
igor-suhorukov 7bce04c06c Polish: combine catches block with same body 2018-02-27 12:51:28 +01:00
Juergen Hoeller c2d5ca9811 Proper nullable return declaration for AbstractValueAdaptingCache.lookup
Issue: SPR-15540
2018-02-26 13:05:12 +01:00
Juergen Hoeller 7d89de06e3 Enforce GMT timezone for testBindInstantFromJavaUtilDate
Issue: SPR-16534
2018-02-26 13:02:17 +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 3531c104b0 Prefer Collections.addAll call with array over Set.addAll(Arrays.asList) 2018-02-25 00:21:39 +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 8d3264f680 Prefer List.sort(Comparator) over Collections.sort(List, Comparator) 2018-02-16 10:23:18 +01:00
Juergen Hoeller 3b810f3544 Consistent Class array vs vararg declarations (and related polishing) 2018-02-14 14:44:00 +01:00
igor-suhorukov 7826567df6 Polish: lamdbas containing only one statement should not nest this statement in a block 2018-02-14 01:22:01 +01:00
Juergen Hoeller 37609e4ede Object/FieldError exposes source object through unwrap/contains methods
Issue: SPR-16372
2018-02-13 17:58:31 +01:00
Juergen Hoeller d3cee45f30 Polishing 2018-02-13 13:15:29 +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
Juergen Hoeller d00e1c5e4f Polishing 2018-02-10 21:35:46 +01:00
Juergen Hoeller 55ee250659 Object/FieldError stores source object as transient (not serialized)
Issue: SPR-16372
2018-02-10 17:41:30 +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 d3a1d44864 Polish: Maps with keys that are enum values should be replaced with EnumMap 2018-02-10 12:09:33 +01:00
Juergen Hoeller 9bb7fcd997 Object/FieldError provides access to source object (exception/violation)
Issue: SPR-16372
2018-02-09 18:42:56 +01:00
Juergen Hoeller c8b860c4b8 Streamlined BeanFactory access within DefaultLifecycleProcessor 2018-02-09 13:31:31 +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
igor-suhorukov e381514b07 Collection.isEmpty() should be used to test for emptiness
Closes gh-1670
2018-02-09 10:11:44 +01:00
Johnny Lim 5c0ddf3c69 Polishing 2018-02-07 10:59:10 +01:00
Juergen Hoeller 5c813a366b Consistent use of @throws instead of @exception 2018-02-05 22:51:51 +01:00
Juergen Hoeller 7f96827ade Polishing 2018-02-02 11:34:03 +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 9c069f6cb1 Avoid String concatenation for not-null assertion in BeanProperty/DirectFieldBindingResult
Issue: SPR-16455
2018-02-02 11:33:39 +01:00
Juergen Hoeller 637e09f995 Polishing 2018-01-30 16:00:30 +01:00
Juergen Hoeller ef2e16912d Formatting support for java.time.Year and java.time.Month
Issue: SPR-16437
2018-01-30 15:54:47 +01:00
Juergen Hoeller 89d2bd954a Properly analyze Java 9 class cast messages for lambda event listeners
Issue: SPR-16435
2018-01-30 15:53:58 +01:00
Juergen Hoeller 0e734d83d5 @EnableAspectJAutoProxy: per application context, requires aspectjweaver
Issue: SPR-14753
Issue: SPR-15801
2018-01-26 10:38:43 +01:00
Juergen Hoeller 37ab8a700b Doc: no "useCodeAsDefaultMessage" for setValidationMessageSource
Issue: SPR-15986
2018-01-26 10:35:37 +01:00
Juergen Hoeller 13c735442c @Scheduled supports java.time.Duration format for its delay attributes
Issue: SPR-15455
2018-01-25 19:11:18 +01:00
Rossen Stoyanchev 97894a1c22 Improve logging dependencies for tests 2018-01-23 10:42:41 -05:00
Juergen Hoeller 9d0e62ef68 Javadoc format and related polishing 2018-01-22 11:43:21 +01:00
Juergen Hoeller 572c668726 Polishing 2018-01-19 21:30:37 +01:00
Johnny Lim d31767eab8 Fix an exception message in ScheduledAnnotationBeanPostProcessor
Closes gh-1636
2018-01-15 15:19:02 +01:00
Juergen Hoeller b160f93495 CacheProxyFactoryBean exposes all relevant CacheInterceptor callbacks
Issue: SPR-16295
2018-01-14 23:48:21 +01:00
Juergen Hoeller 06e6386dc9 CollectionUtils.lastElement for common Set/List extraction
Issue: SPR-16374
2018-01-12 18:23:52 +01:00
Juergen Hoeller 13a8f90e08 ScheduledAnnotationBeanPostProcessor properly deals with nested proxies
Issue: SPR-16196
2018-01-12 16:48:17 +01:00
Juergen Hoeller c8bdb3c602 Polishing 2018-01-09 22:20:22 +01:00
Masahiro Ide d9af4d6599 ResourceBundleMessageSource uses ConcurrentHashMaps instead of synchronization
Issue: https://jira.spring.io/browse/SPR-16235
2018-01-09 22:12:03 +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 d187cbce73 LoadTimeWeaver detection differentiates between WebSphere and Liberty
Issue SPR-16248
2018-01-07 23:29:16 +01:00
Juergen Hoeller 977550f956 Properly handle null bean instance in getLifecycleBeans
Issue: SPR-16343
2018-01-07 23:23:08 +01:00
Juergen Hoeller 18d90ec140 Properly handle null FactoryBean instance
Issue: SPR-16250
2018-01-07 23:22:56 +01:00
Juergen Hoeller 4577a19190 Upgrade to Commons Pool 2.5 (and Jackson Kotlin Module 2.9.3) 2017-12-21 13:52:00 +01:00
Philipp Grogg 591429e538 Fix exception message
initialDelayString is parsed into long, not integer.

Closes gh-1615
2017-12-09 15:46:28 -08:00
Sam Brannen 773cd3241b Polishing 2017-11-28 14:11:21 +01:00
sdeleuze 9f1d8517ba Polish Kotlin source code style 2017-11-21 15:59:23 +01:00
Juergen Hoeller 5843173567 Polishing 2017-11-21 13:42:57 +01:00
Juergen Hoeller 08c95fbcb3 Unit tests for configuration superclass inclusion
Issue: SPR-16217
2017-11-21 13:42:01 +01:00
Juergen Hoeller 40dacd3c1c Polishing 2017-11-20 22:27:07 +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 85baba33bf Accessors for PeriodicTrigger properties
Issue: SPR-15982
2017-11-14 17:09:19 +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 e2bb06edbd Unit tests for unresolvable generics with partial mismatch
Issue: SPR-16179
2017-11-13 21:51:02 +01:00
Juergen Hoeller 3091feee23 SpringValidatorAdapter skips value retrieval for Set field without index
Issue: SPR-16177
2017-11-13 21:50:55 +01:00
Juergen Hoeller ffd6eff369 Scheduled task introspection through ScheduledTaskHolder interface
Issue: SPR-15982
2017-11-06 18:36:39 +01:00
Juergen Hoeller 9511d29adb Updated bean count expectations in ClassPathBeanDefinitionScannerTests
Issue: SPR-16152
2017-11-06 18:36:29 +01:00
Stephane Nicoll 1838ddb95d Support Ant-style package name with component index
This commit improves the component index so that it supports ant-style
package name (i.e. com.example.**.foo).

Issue: SPR-16152
2017-11-06 15:19:30 +01:00
Juergen Hoeller 996d747aed Upgrade to Mockito 2.11
Includes fixes for invalid exception declarations in Mockito-based unit tests. Also includes FreeMarker 2.3.27, Commons Pool 2.4.3, JSON-P 1.1.2.

Issue: SPR-16157
2017-11-04 01:06:59 +01:00
Juergen Hoeller 1611ce7180 AbstractApplicationContext silently ignores non-initialized ApplicationEventMulticaster/LifecycleProcessor on destruction
Issue: SPR-16149
2017-11-02 16:07:12 +01:00
Juergen Hoeller e5c8dc0d65 MessageSource.getMessage returns null default message as-is (again)
Issue: SPR-16127
2017-10-31 11:06:42 +01:00
Haruki Okada 159da04eed Fix wrong javadoc example
Closes gh-1575
2017-10-23 09:20:19 +02:00
Juergen Hoeller c7100f771c Explicit notes on advice mode proxy vs aspectj
Issue: SPR-16092
2017-10-22 20:34:34 +02:00
Juergen Hoeller e17ad551f3 Latest dependency updates (RxJava 1.3.3, Hibernate ORM 5.2.12, Hibernate Validator 5.4.2 & 6.0.3) 2017-10-20 16:16:06 +02:00
Juergen Hoeller d1fac36e3e SchedulingConfigurer and JmsListenerConfigurer respect @Order
Issue: SPR-16090
2017-10-20 16:10:12 +02:00
Juergen Hoeller c3378fda33 AbstractMessageSource properly interacts with non-AbstractMessageSource parent
Issue: SPR-16047
2017-10-18 20:21:12 +02:00
Juergen Hoeller d1b5b5d2f7 Clarify destroy method suppression for DisposableBean vs (Auto)Closeable
Issue: SPR-16078

(cherry picked from commit dff2c84)
2017-10-16 23:53:02 +02:00
Juergen Hoeller 43b5e21947 Consistent alias declarations for value attribute on stereotypes
Issue: SPR-16066
2017-10-13 18:18:12 +02:00
Juergen Hoeller 625737f90a Controller/Repository/Service declare value attribute as alias for Component
Issue: SPR-16066
2017-10-13 14:24:12 +02:00
Juergen Hoeller ad4c8e7c0d Consistently sort BeanDefinitionRegistryPostProcessors
Issue: SPR-16043
2017-10-09 13:59:09 +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
Juergen Hoeller efce7902c4 Polishing 2017-09-27 01:34:11 +02:00
Juergen Hoeller a4b2ae583e Expose AspectJ 1.8.11 in POMs (and use it for all tests)
Issue: SPR-15974
2017-09-27 01:34:02 +02:00
Sebastien Deleuze 23497a7ece Support autowiring by constructor in Kotlin bean DSL
Issue: SPR-16014
2017-09-27 01:25:22 +02:00
Sebastien Deleuze 14cba15296 Open router and bean Kotlin DSL to allow building custom ones 2017-09-26 16:31:16 +02:00
Juergen Hoeller ac45aa2022 Upgrade to AspectJ 1.9 beta 7 (with 1.8.10 exposed in POMs)
Issue: SPR-15974
2017-09-25 13:50:50 +02:00
Juergen Hoeller e2882fe1db Build against EE 8 API level wherever possible
Upgrade to JAXB 2.3, JAX-WS 2.3, Annotations 1.3.1, Interceptor 1.2.1.
Also includes Log4J 2.9.1 and Asciidoctor 1.5.6.
2017-09-24 17:18:21 +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
Xavier Downs dba1ef0b26 Fix Javadoc typo
Closes gh-1531
2017-09-20 09:30: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
Juergen Hoeller 30d67f7c42 Tests for @Lazy Validator setup
Issue: SPR-15807
2017-09-10 21:56:23 +02:00
Sebastien Deleuze 8b8a6766de Change BeanDefinitionDsl to implement ApplicationContextInitializer 2017-09-04 10:46:20 +02:00
Juergen Hoeller 26284cac4f Hibernate Validator 5 compatible support for element constraints
Issue: SPR-15916
Issue: SPR-15839
2017-09-01 16:40:24 +02:00
Juergen Hoeller 97ded1dcc7 Polishing 2017-09-01 14:05:35 +02:00
Juergen Hoeller 30bd5827b0 ConfigurationClassEnhancer leniently allows for null bean references
Issue: SPR-15829
2017-09-01 14:05:14 +02:00
Sebastien Deleuze d2c1b284f3 Polish Kotlin API contracts and documentation
Issue: SPR-15659
2017-08-29 00:56:39 +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
Brian Clozel 2eeb428e95 Move modules to independent build files
The main `build.gradle` file contains now only the common build
infrastructure; all module-specific build configurations have
been moved to their own build file.

Issue: SPR-15885
2017-08-21 14:41:55 +02:00
Stephane Nicoll f6e7fef236 Polish 2017-08-19 10:50:41 +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
Juergen Hoeller ec1eafc46f @Lazy falls back to empty map/list/set for non-required collection dependency
Issue: SPR-15858
2017-08-17 12:28:55 +02:00
Juergen Hoeller adeb521ce4 Polishing 2017-08-08 17:27:28 +02:00
Juergen Hoeller de09f8ca1f Support for Bean Validation 2.0 container elements (with BV 2.0 test setup)
Includes latest dependency updates (Hibernate Validator 6.0.1, Caffeine 2.5.4, Netty 4.1.14, Tomcat 8.5.19, Johnzon 1.1.2, JsonPath 2.4, Jython 2.7.1)

Issue: SPR-15839
Issue: SPR-15808
2017-08-08 17:26:30 +02:00
Juergen Hoeller ca0983cd85 Polishing 2017-08-01 12:08:57 +02:00
Juergen Hoeller dd2bbcb3ec Leniently handle lambda-defined listeners with ErrorHandler as well
Issue: SPR-15838
2017-08-01 12:06:41 +02:00
Juergen Hoeller 1fbd047003 checkConfigurationClassCandidate explicitly skips factory method definitions
Issue: SPR-14603
2017-08-01 12:05:26 +02:00
Sebastien Deleuze 29c112c010 Avoid requiring `it` parameter in Kotlin bean DSL
By using function literals with receiver, we can avoid requiring
lambda parameters for a shorter and nicer syntax. Based on a
proposal from Joseph Taylor.

Issue: SPR-15815
2017-07-25 11:21:08 +02:00
Juergen Hoeller ac1d3b22c9 Polishing 2017-07-19 22:22:27 +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
Sebastien Deleuze ff85726fa9 Fix warnings in Kotlin tests 2017-07-19 08:12:48 +02:00
Sebastien Deleuze e2fd04dff3 Add a [] Kotlin extension for PropertyResolver#getRequiredProperty 2017-07-19 08:12:32 +02:00
Sebastien Deleuze f72e0daa54 Add an env accessor to BeanDefinitionContext
Issue: SPR-15755
2017-07-19 07:57:19 +02:00
Juergen Hoeller c292a89b24 Http(Async)Client not actually nullable, plus MethodInterceptor nullability
Issue: SPR-15720
2017-07-19 00:15:37 +02:00
Juergen Hoeller bca5a36216 Explicit error message for bean name clash with containing configuration class
Issue: SPR-15775
2017-07-18 00:54:49 +02:00
Sebastien Deleuze 1f011467b8 Introduce Kotlin functional bean definition DSL
As a follow-up of the ApplicationContext Kotlin extensions, close to
the Kotlin functional WebFlux DSL and partially inspired of the
Groovy/Scala bean configuration DSL, this commit introduces a
lightweight Kotlin DSL for functional bean declaration.

It allows declaring beans as following:

beans {
	bean<Foo>()
	profile("bar") {
		bean<Bar>("bar", scope = Scope.PROTOTYPE)
	}
	environment({ it.activeProfiles.contains("baz") }) {
		bean { Baz(it.ref()) }
		bean { Baz(it.ref("bar")) }
	}
}

Advantages compared to Regular ApplicationContext API are:
 - No exposure of low-level ApplicationContext API
 - Focused DSL easier to read, but also easier to write with a fewer
   entries in the auto-complete
 - Declarative syntax instead of functions with verbs like registerBeans
   while still allowing programmatic registration of beans if needed
 - Such DSL is idiomatic in Kotlin
 - No need to have an ApplicationContext instance to write how you
   register your beans since beans { } DSL is conceptually a
   Consumer<GenericApplicationContext>

This DSL effectively replaces ApplicationContext Kotlin extensions as
the recommended way to register beans in a functional way with Kotlin.

Issue: SPR-15755
2017-07-12 16:38:41 +02:00
Juergen Hoeller e7b77cb2b6 Drop legacy DisposableBean declaration on AbstractApplicationContext
Issue: SPR-15154
2017-07-07 20:50:35 +02:00
Juergen Hoeller 59c26f65ba AbstractValueAdaptingCache subclasses may reuse NullValue.INSTANCE
Issue: SPR-15693
2017-07-05 17:55:11 +02:00
Juergen Hoeller eb928ce456 Reliably detect event listener conditions on proxied beans
Issue: SPR-15678
2017-07-05 13:41:56 +02:00
Juergen Hoeller 5f4d1a4628 CronSequenceGenerator.isValidExpression actually validates cron fields
Issue: SPR-15604
2017-06-30 01:54:32 +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
Juergen Hoeller 87430f3cd3 ListenableFuture provides CompletableFuture adaptation via completable()
Issue: SPR-15696
2017-06-27 00:43:37 +02:00
Juergen Hoeller 03133630cb Missing @Nullable annotations in WebFlux, in particular around locale resolution
Issue: SPR-15036
Issue: SPR-15540
2017-06-20 18:08:42 +02:00
Juergen Hoeller 535103cd52 Fine-tune HTTP/RMI Invoker exception handling
Issue: SPR-15684
2017-06-20 16:50:35 +02:00
Sebastien Deleuze 04d5a2951c Remove KClass based Kotlin extensions
Issue: SPR-15660
2017-06-13 18:43:59 +02:00
Sebastien Deleuze e0e6736bc5 Introduce LocaleContextResolver in WebFlux
This commit introduces LocaleContextResolver interface, which is used
at ServerWebExchange level to resolve Locale, TimeZone and other i18n
related informations.

It follows Spring MVC locale resolution patterns with a few differences:
 - Only LocaleContextResolver is supported since LocaleResolver is less
   flexible
 - Support is implemented in the org.springframework.web.server.i18n
   package of spring-web module rather than in spring-webflux in order
   to be able to leverage it at ServerWebExchange level

2 implementations are provided:
 - FixedLocaleContextResolver
 - AcceptHeaderLocaleContextResolver

It can be configured with both functional or annotation-based APIs.

Issue: SPR-15036
2017-06-13 15:10:18 +02:00
Juergen Hoeller 779deb0fa7 Cleanup of duplicate semicolons
Issue: SPR-15654
2017-06-13 11:38:05 +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
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
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 55b0fe1027 Unwrap SpringValidatorAdapter (e.g. CustomValidatorBean) to native Validator
Issue: SPR-15629
(cherry picked from commit 8330134)
2017-06-07 18:33:13 +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 b494c53b40 Avoid defining nullability for non-relevant API
Defining nullability of some API like EnvironmentCapable
or ConditionContext causes issues in Spring Boot because
in the context where they are used, it is known for sure
they will return non-null values even if their API can in
other context return null values.

It is better in this case for both Java and Kotlin to
not define at all the nullabity of such API.

In practice, this is achieved by removing the package level
@NonNullApi annotation and adding it only on the
relevant classes.

Issue: SPR-15540
2017-05-31 22:51:33 +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 3cc94ae8b5 Consistently accept "taskExecutor" bean of type Executor (as stated in @EnableAsync's javadoc)
Issue: SPR-15566
2017-05-25 23:37:02 +02:00
Andy Clement 109746a03b Adjust source in test class to work around eclipse compiler bug
Issue: SPR-15586
2017-05-24 13:24:24 -07:00
Juergen Hoeller cb3d1befcd LocalValidatorFactoryBean properly supports unwrap at ValidatorFactory level
Also documents limitation for Bean Validation 2.0's getClockProvider() method.

Issue: SPR-15561
Issue: SPR-13482
2017-05-18 21:00:56 +02:00
Juergen Hoeller ba501791c9 Consistent use of WebFlux terminology over Web Reactive 2017-05-05 14:21:01 +02:00
Juergen Hoeller 1f5eaf20b0 Basic test for functional bean registration within a configuration class
Issue: SPR-13779
2017-05-04 11:26:21 +02:00
Juergen Hoeller 1ea54eb2c6 GenericFilterBean lazily initializes its default environment
Alignment with HttpServletBean; consistent use of EnvironmentCapable.

Issue: SPR-15469
2017-04-27 21:38:30 +02:00
Juergen Hoeller 8b50f887db Caching annotations on interface methods with CGLIB proxies
Issue: SPR-15271
2017-04-26 18:16:47 +02:00
Juergen Hoeller 6c43d14a77 Async annotations on interface methods with CGLIB proxies
Issue: SPR-14949
2017-04-26 18:16:40 +02:00
Juergen Hoeller 91df0653fe Polishing 2017-04-17 15:05:34 +02:00
Juergen Hoeller 5d3249f692 Recommendation for consistent @Profile declarations on overloaded @Bean methods
Issue: SPR-15266
2017-04-17 14:52:06 +02:00
Juergen Hoeller 022aefdfe8 Explicit note about @Profile declarations on overloaded @Bean methods
Also marks @Conditional as @Documented, aligned with other annotations.

Issue: SPR-15266
2017-04-15 14:17:45 +02:00
Juergen Hoeller 9abf249cee Explicitly replace target ApplicationListener with singleton proxy, if any (avoiding double registration/invocation)
Issue: SPR-15452
2017-04-15 14:10:28 +02:00
Juergen Hoeller 0b118322b0 Polishing 2017-04-13 16:17:05 +02:00
Juergen Hoeller 1735ba22cb ShadowingClassLoader can be constructed without default excludes
Issue: SPR-15439
2017-04-12 15:34:50 +02:00
Juergen Hoeller c4e0d6c2a2 UnknownHostException as resource-not-found for properties files
Plus first-class declaration of FileNotFoundException in Resource javadoc.

Issue: SPR-15433
2017-04-11 11:45:30 +02:00
Juergen Hoeller 15b5dd9f12 Polishing 2017-04-10 15:36:45 +02:00
Juergen Hoeller a95843a068 Dependency tracking for Supplier-created beans
Issue: SPR-15417
2017-04-07 18:01:28 +02:00
Juergen Hoeller 67ea4b3a05 package-info for repackaged libraries (and other polishing) 2017-04-06 14:10:46 +02:00
Juergen Hoeller 917207b7ae Support for @Order on nested configuration classes
Issue: SPR-15384
2017-04-04 17:17:03 +02:00
Sam Brannen 51f23cb424 Polish JavaDoc for date-time and number format annotations 2017-04-03 16:48:05 +02:00
Sam Brannen 279c56a385 Fix typo in JavaDoc 2017-04-03 16:43:55 +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
Sam Brannen 0b11785852 Improve tests for PropertySourcesPlaceholderConfigurer 2017-03-28 19:26:45 +02:00
QBNemo 26101892c1 Fix typo
Closes gh-1354
2017-03-27 10:11:50 +02:00
Grant Hutchins e087db1ecb Fix typo
Closes gh-1364
2017-03-27 10:04:15 +02:00
Juergen Hoeller e892e02f41 Polishing 2017-03-21 17:44:47 +01:00
Juergen Hoeller fc2e635c05 Lookup methods work on configuration classes as well
Issue: SPR-15316
2017-03-07 13:51:43 +01:00
Juergen Hoeller 6d6cf01a42 Polishing 2017-02-28 13:13:23 +01:00