Commit Graph

554 Commits

Author SHA1 Message Date
Stéphane Nicoll 1da40b84e7 Polish "Use idiomatic AssertJ map assertions"
See gh-31752
2023-12-05 10:39:33 +01:00
Sam Brannen 6ea9fdbf77 Polishing 2023-11-30 19:04:59 +01:00
Juergen Hoeller 824bc09d11 Actual caching of null values in retrieve(key, valueLoader)
See gh-31637
2023-11-22 15:56:26 +01:00
Juergen Hoeller e64b81eec4 Revised handling of allowNullValues for asynchronous retrieval
Includes revised cacheNames javadoc and equals/hashCode for SimpleValueWrapper.

See gh-31637
2023-11-22 12:22:13 +01:00
Juergen Hoeller 1410c466b7 Support for late-determined cache misses from retrieve(key)
Closes gh-31637
2023-11-21 23:11:34 +01:00
Stéphane Nicoll dd97dee7fd Polish 2023-11-13 19:33:09 +01:00
Johnny Lim 64e9fcad53 Apply SingleSpaceSeparator Checkstyle module
This commit also fixes its violations.

Closes gh-31469
2023-10-22 14:09:57 +02:00
Stéphane Nicoll 2fbcff8919 Prevent ValueLoaderEntryProcessor to be created for each get call
Closes gh-31250
2023-09-18 09:27:16 +02:00
Stéphane Nicoll f79bc7b14d Implement JCacheCache#putIfAbsent as atomic operation
This commit modifies putIfAbsent to use an EntryProcessor that
guarantees that the operation is atomic.

Closes gh-21591
2023-09-18 09:09:47 +02:00
Stéphane Nicoll 978c409d85 Polish contribution
See gh-23651
2023-09-15 10:25:16 +02:00
Rune Flobakk f67fad4c14 Add default methods to MailSender and JavaMailSender when appropriate
send(..) -methods of JavaMailSenderImpl which is only delegating to
other methods are pulled up as default methods in the interfaces
JavaMailSender and MailSender, to make these interfaces require fewer
methods to implement.

See gh-23651
2023-09-15 10:25:06 +02:00
Stephane Nicoll 01f717375b Introduce ObjectUtils#nullSafeHash(Object... element)
This commit deprecates the various nullSafeHashCode methods taking array
types as they are superseded by Arrays.hashCode now. This means that
the now only remaining nullSafeHashCode method does not trigger a
warning only if the target type is not an array. At the same time, there
are multiple use of this method on several elements, handling the
accumulation of hash codes.

For that reason, this commit also introduces a nullSafeHash that takes
an array of elements. The only difference between Objects.hash is that
this method handles arrays.

The codebase has been reviewed to use any of those two methods when it
is possible.

Closes gh-29051
2023-09-13 15:14:34 +02:00
Stephane Nicoll 2b76c4d847 Polish "Wrap ternary operator within parentheses"
See gh-31076
2023-08-22 15:40:16 +02:00
Juergen Hoeller 45c20e34e4 Merge branch '6.0.x'
# Conflicts:
#	spring-context/src/test/java/org/springframework/context/annotation/PropertySourceAnnotationTests.java
2023-08-14 19:29:14 +02:00
Juergen Hoeller 2ce75dc415 Polishing 2023-08-14 19:28:19 +02:00
Juergen Hoeller 3804b1c602 Merge branch '6.0.x'
# Conflicts:
#	spring-context/src/main/java/org/springframework/context/annotation/ClassPathBeanDefinitionScanner.java
#	spring-core/src/main/java/org/springframework/core/ReactiveAdapterRegistry.java
#	spring-r2dbc/src/test/java/org/springframework/r2dbc/connection/R2dbcTransactionManagerUnitTests.java
2023-08-06 14:26:55 +02:00
Juergen Hoeller 6e5af9dccb Polishing 2023-08-06 14:25:39 +02:00
Sam Brannen 7c5b2db5bf Suppress warnings in tests 2023-08-02 11:09:56 +03:00
Juergen Hoeller d250a5155a Consistent dependency declarations 2023-08-02 00:56:50 +02:00
Juergen Hoeller 3b1af692cc Merge branch '6.0.x'
# Conflicts:
#	spring-beans/spring-beans.gradle
#	spring-context/spring-context.gradle
#	spring-orm/spring-orm.gradle
#	spring-test/spring-test.gradle
#	spring-web/spring-web.gradle
#	spring-webflux/spring-webflux.gradle
2023-08-02 01:04:31 +02:00
Sam Brannen 170d6bfdad Clean up warnings in tests 2023-07-31 16:17:48 +03:00
Sam Brannen 81181c346a Assert SimpleTriggerFactoryBean.setMisfireInstruction() values
See gh-30851
2023-07-31 16:08:47 +03:00
Sam Brannen 1378cce9fb Assert CronTriggerFactoryBean.setMisfireInstruction() values
See gh-30851
2023-07-31 16:08:47 +03:00
Juergen Hoeller 3a9e0ea8a7 Polishing 2023-07-22 00:31:09 +02:00
Juergen Hoeller ba46d2bf21 Polishing 2023-07-21 23:57:20 +02:00
Juergen Hoeller 4ce1ac0dcb Polishing 2023-07-21 20:36:43 +02:00
Juergen Hoeller f99faac073 Add caching annotation support for CompletableFuture and reactive return values
Includes CompletableFuture-based retrieve operations on Spring's Cache interface.
Includes support for retrieve operations on CaffeineCache and ConcurrentMapCache.
Includes async cache mode option on CaffeineCacheManager.

Closes gh-17559
Closes gh-17920
Closes gh-30122
2023-07-21 20:27:23 +02:00
Juergen Hoeller 25ea1f4c0f Merge branch '6.0.x'
# Conflicts:
#	spring-context/src/main/java/org/springframework/scheduling/support/CronSequenceGenerator.java
2023-07-19 00:37:06 +02:00
Juergen Hoeller 2f33e77ab4 Consistent equals/hashCode style (and related polishing) 2023-07-19 00:35:19 +02:00
Sam Brannen 28e63e9279 Polishing 2023-07-16 14:35:22 +02:00
Sam Brannen 11de70ed08 Update Javadoc for SimpleTriggerFactoryBean.setMisfireInstructionName()
org.quartz.Trigger#MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY is also
supported.
2023-07-16 14:34:42 +02:00
Sam Brannen 9283fd2162 Update Javadoc for CronTriggerFactoryBean.setMisfireInstructionName()
org.quartz.Trigger#MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY is also
supported.
2023-07-16 14:05:24 +02:00
Sam Brannen d6230824cb Stop using Constants utility in SimpleTriggerFactoryBean
See gh-30851
2023-07-16 15:00:11 +02:00
Sam Brannen edba535c8b Stop using Constants utility in CronTriggerFactoryBean
See gh-30851
2023-07-16 15:00:11 +02:00
Sam Brannen 79cf532c2f Merge branch '6.0.x' 2023-07-16 14:36:09 +02:00
Sam Brannen f6b8ee76cd Merge branch '6.0.x' 2023-07-16 14:05:46 +02:00
Juergen Hoeller 60865eae4b Align ConcurrentMapCacheManager locking behavior with CaffeineCacheManager
Closes gh-30780
2023-06-30 10:39:53 +02:00
Juergen Hoeller 50074f0e96 Merge branch '6.0.x' 2023-06-30 10:40:37 +02:00
Juergen Hoeller ef2b47e202 Merge branch '6.0.x' 2023-06-08 17:46:19 +02:00
Juergen Hoeller 6931106c5e Redesign inner Pointcut implementations as standalone classes
Avoids exposure of implicit Advisor instance state in Pointcut instance.

See gh-30621
2023-06-08 17:42:49 +02:00
Sam Brannen 7169577f9c Merge branch '6.0.x' 2023-05-24 16:57:30 +02:00
Sam Brannen 6dfd330fa5 Polish JavaMailSenderTests 2023-05-24 16:54:44 +02:00
Juergen Hoeller 697d5e6247 Configuration options for virtual threads (on JDK 21)
VirtualThreadDelegate built on JDK 21 for multi-release jar.
Includes dedicated VirtualThreadTaskExecutor as lean option.
Includes setVirtualThreads flag on SimpleAsyncTaskExecutor.
Includes additional default methods on AsyncTaskExecutor.

Closes gh-30241
2023-05-08 11:22:47 +02:00
Juergen Hoeller d39e44c209 Deprecate AutowireCapableBeanFactory.createBean(Class, int, boolean)
Includes consistent usage of createBean(Class) in SpringBeanJobFactory and SpringBeanContainer.

Closes gh-30345
See gh-29855
See gh-30041
2023-04-30 23:07:29 +02:00
Krzysztof Krasoń 1734deca1e
Refactor AssertJ assertions into more idiomatic ones
This commit refactors some AssertJ assertions into more idiomatic and
readable ones. Using the dedicated assertion instead of a generic one
will produce more meaningful error messages. 

For instance, consider collection size:
```
// expected: 5 but was: 2
assertThat(collection.size()).equals(5);
// Expected size: 5 but was: 2 in: [1, 2]
assertThat(collection).hasSize(5);
```

Closes gh-30104
2023-04-04 17:34:07 +02:00
Brian Clozel 6cd67412cc Avoid lock contention in CaffeineCacheManager
Prior to this commit, using a dynamic `CaffeineCacheManager` would rely
on `ConcurrentHashMap#computeIfAbsent` for retrieving and creating cache
instances as needed. It turns out that using this method concurrently
can cause lock contention even when all known cache instances are
instantiated.

This commit avoids using this method if the cache instance already
exists and avoid storing `null` entries in the map. This change reduces
lock contention and the overall HashMap size in the non-dynamic case.

Fixes gh-30066
2023-03-08 16:23:32 +01:00
Sam Brannen 162c09d036 Apply "instanceof pattern matching" in remainder of spring-context-support module
See gh-30067
2023-03-05 19:09:32 +01:00
Juergen Hoeller f8cb0fa2a0 Custom resolution of preferred constructors for createBean(Class)
Avoids side effects of traditional AUTOWIRE_CONSTRUCTOR algorithm.

Closes gh-30041
2023-03-02 12:54:26 +01:00
Sam Brannen 2e1374b459 Update copyright headers 2023-02-19 13:41:36 +01:00
Johnny Lim 431ae03447 Polish
Closes gh-29928
2023-02-09 09:54:19 +01:00
Juergen Hoeller 0e8838db90 Flexible constructor resolution in AutowireCapableBeanFactory.createBean(Class)
Closes gh-29855
See gh-29823
2023-01-19 17:10:42 +01:00
Sam Brannen 0502d18e3d Update copyright headers 2023-01-19 16:20:03 +01:00
Sam Brannen c4c786596f Migrate to Mockito.mock(T...) where feasible 2023-01-19 16:20:02 +01:00
Sam Brannen a4956dfe26 Update copyright headers 2023-01-11 13:52:20 +01:00
Krzysztof Krason afb8a0d1b1 Use new Java features (switch expressions, text blocks, new JDK methods)
Closes gh-29747
2023-01-11 13:51:28 +01:00
Sam Brannen ad60164911 Update copyright headers for source code changed since August 2022
The changes in this commit were performed using the newly introduced
update_copyright_headers.sh script.
2022-11-29 19:38:42 +01:00
Sam Brannen 7fcd1de8e3 Use AssertJ's isEmpty() instead of hasSize(0)
Achieved via global search-and-replace.
2022-11-22 17:11:50 +01:00
Sam Brannen d5b0b2b1a1 User AssertJ's hasSize() for arrays
Achieved via global search-and-replace.
2022-11-22 17:03:45 +01:00
Sam Brannen 36f7597f25 Use AssertJ's hasSize() for collections and maps
Achieved via a global search-and-replace.
2022-11-22 16:50:10 +01:00
Sam Brannen 43f8d9e084 Apply 'instanceof pattern matching' 2022-11-22 16:27:34 +01:00
Sam Brannen abf3400c07 Use Assert.state() where appropriate 2022-11-15 12:31:10 +01:00
Sam Brannen eb91d21ada Polishing 2022-11-13 18:21:56 +01:00
Sam Brannen 9d73f81e9c Avoid String allocations with Assert.notNull() 2022-11-08 14:23:22 +01:00
Sébastien Deleuze c091bbdeaa Merge branch '5.3.x' 2022-11-02 12:18:15 +01:00
Steve Gerhardt fded79d807 Make SimpleMailMessage setters parameters nullable
Closes gh-29139
2022-11-02 12:18:03 +01:00
Sam Brannen 321092ce6f Consistent use of @Deprecated(since = "6.0") 2022-09-20 14:34:24 +02:00
Sam Brannen b87d48b99b Merge branch '5.3.x' 2022-09-14 17:18:00 +02:00
Marc Wrobel ce49068ff9 Fix links in Javadoc and reference docs
- Fix broken links (by using a new URL, an alternative URL, or a
  Wayback Machine link)

- Use HTTPS where possible

- Remove https://issuetracker.springsource.com/browse/EBR-349: this
  link is dead and is also mentioned in
  https://jira.spring.io/browse/SPR-8093

- Clean up nohttp allowlist.lines

Closes gh-28876
2022-09-14 17:00:11 +02:00
Phillip Webb 505da5c602 Migrate hint registration to shortcuts
Migrate code to make use of the `MemberCategory` and `FieldMode`
shortcuts.

See gh-29011
2022-09-01 17:26:06 -07:00
Sébastien Deleuze 08f636b691 Introduce TypeHint.Builder#onReachableType(Class<?>)
Closes gh-29017
2022-08-26 08:34:54 +02:00
Stephane Nicoll d6afa8df2d Improve registration of the same hint for multiple classes
Based on the feedback in #28977 an easy way to create a list of
type references based on a vararg of classes is helpful when
registering the same hints for several types.
2022-08-18 06:52:34 +02:00
Sébastien Deleuze 5c68a278b5 Add SchedulerFactoryBean runtime hints
Also require oracle/graalvm-reachability-metadata#19.

Closes gh-28725
2022-08-11 15:42:53 +02:00
Arjen Poutsma 2aa74c9121 Deprecate ListenableFuture in favor of CompletableFuture
This commit deprecates ListenableFuture in favor of CompletableFuture.
ListenableFuture was introduced in Spring Framework 4.0, when
CompletableFuture was not yet available. Spring now requires JDK 17, so
having our own type no longer seems necessary.

Major changes in this commit include:
- Deprecation of ListenableFuture and related types
  (ListenableFutureCallback, SettableListenableFuture, etc.)
- Deprecation of AsyncListenableTaskExecutor in favor of default methods
  in AsyncTaskExecutor (submitCompletable).
- AsyncHandlerMethodReturnValueHandler now has toCompletableFuture
  instead of toListenableFuture.
- WebSocketClient now has execute methods, which do the same as
  doHandshake, but return CompletableFutures (cf. the reactive
  WebSocketClient).

All other changes
- add an overloaded method that takes a CompletableFuture parameter
  instead of ListenableFuture, and/or
- add a method with a 'Async' suffix that returns a CompletableFuture
  instead of a ListenableFuture (connectAsync, sendAsync).

Closes gh-27780
2022-07-27 12:41:35 +02:00
Sam Brannen aae9050351 Merge branch '5.3.x'
# Conflicts:
#	spring-context/src/main/java/org/springframework/scheduling/annotation/Async.java
#	spring-context/src/testFixtures/java/org/springframework/context/testfixture/jndi/SimpleNamingContextBuilder.java
#	spring-core/src/main/java/org/springframework/core/BridgeMethodResolver.java
#	spring-core/src/main/java/org/springframework/util/MimeType.java
2022-07-13 14:55:30 +02:00
Marc Wrobel c48c5e7691 Fix and improve Javadoc in spring-context
Closes gh-28802
2022-07-13 14:45:23 +02:00
Stephane Nicoll 2c92d7da8f Harmonize RuntimeHintsRegistrar implementations
Closes gh-28801
2022-07-12 18:30:23 +02:00
Sébastien Deleuze 16c43c2041 Add resource hints for Javamail mime.types
Closes gh-28690
2022-06-23 19:04:10 +02:00
Sam Brannen ee209de9cf Merge branch '5.3.x'
# Conflicts:
#	spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java
#	spring-context/src/test/java/org/springframework/ejb/access/LocalSlsbInvokerInterceptorTests.java
#	spring-context/src/test/java/org/springframework/ejb/access/SimpleRemoteSlsbInvokerInterceptorTests.java
#	spring-web/src/test/java/org/springframework/remoting/jaxws/JaxWsSupportTests.java
#	spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/ViewResolutionIntegrationTests.java
2022-05-31 14:15:36 +02:00
Sam Brannen 1beb7068f6 Use new AssertJ exception assertions 2022-05-31 14:08:28 +02:00
Juergen Hoeller 35de7e19ee Introduce initializer callback for Bean Validation Configuration
Closes gh-27956
2022-04-08 14:39:36 +02:00
Sam Brannen c8d0146bcc Polish contribution
See gh-28075
2022-03-29 13:39:40 +02:00
Loïc Ledoyen 7f7fb58dd0 Deprecate SerializationUtils#deserialize
Since SerializationUtils#deserialize is based on Java's serialization
mechanism, it can be the source of Remote Code Execution (RCE)
vulnerabilities.

Closes gh-28075
2022-03-29 13:07:36 +02:00
Sam Brannen 8c6d59aaaf Polish contribution
See gh-28014
2022-02-19 14:43:26 +01:00
a.yazychyan c5c926726d Use enhanced switch expressions where feasible
Closes gh-28014
2022-02-19 14:34:05 +01:00
Juergen Hoeller 3eb9886724 Merge branch '5.3.x'
# Conflicts:
#	spring-context-support/src/main/java/org/springframework/scheduling/commonj/WorkManagerTaskExecutor.java
#	spring-core/src/main/java/org/springframework/core/task/SimpleAsyncTaskExecutor.java
#	spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectivePropertyAccessor.java
#	spring-tx/src/main/java/org/springframework/jca/work/SimpleTaskWorkManager.java
#	spring-tx/src/main/java/org/springframework/jca/work/WorkManagerTaskExecutor.java
2022-02-04 23:24:21 +01:00
Juergen Hoeller a71a45e719 Deprecate AsyncTaskExecutor.execute(Runnable task, long startTimeout)
Closes gh-27959
2022-02-04 23:21:00 +01:00
Sam Brannen 54565e95b5 Merge branch '5.3.x' 2022-02-03 14:58:36 +01:00
Sam Brannen f8a5a8d7be Use modern language features in tests 2022-02-03 14:50:10 +01:00
Sam Brannen d57bc176f2 Merge branch '5.3.x' 2022-01-10 14:21:25 +01:00
Sam Brannen df263d01b9 Use idiomatic AssertJ assertions for true, false, and null 2022-01-10 14:15:55 +01:00
izeye f0125afb5e Remove references to JCacheConfigurerSupport and CachingConfigurerSupport
See gh-27863
2021-12-29 10:53:56 +01:00
Stephane Nicoll 2f3a9dbc68 Deprecate CachingConfigurerSupport and AsyncConfigurerSupport
Closes gh-27813
2021-12-15 12:03:39 +01:00
Stephane Nicoll b6faaf1fc1 Merge branch '5.3.x' 2021-12-15 10:59:50 +01:00
Stephane Nicoll c7642422c3 Stop resolving CachingConfigurer instances eagerly
Closes gh-27751
2021-12-15 10:52:09 +01:00
Juergen Hoeller bdbcc4f98c Merge branch '5.3.x'
# Conflicts:
#	build.gradle
2021-12-14 18:37:46 +01:00
Juergen Hoeller f191cf4eb3 Revised comment on explicit LocalDataSourceJobStore configuration
See gh-27709
2021-12-14 18:32:32 +01:00
Juergen Hoeller bfdb93b406 Merge branch '5.3.x'
# Conflicts:
#	build.gradle
#	src/docs/asciidoc/integration.adoc
2021-12-14 16:51:00 +01:00
Juergen Hoeller d7b9270672 Clarify SchedulerFactoryBean's LocalDataSourceJobStore overriding
Includes clarification of interface-level cache annotations for target-class proxies.

Closes gh-27709
See gh-27726
2021-12-14 16:46:13 +01:00
Stephane Nicoll 8d93dc4abb Merge branch '5.3.x' 2021-12-14 14:05:18 +01:00
Stephane Nicoll 8422d9d22f Add default methods to CachingConfigurer
This commit adds default methods to CachingConfigurer and
JCacheConfigurer and removes the reference to their respective support
classes as they are now irrelevant.

Closes gh-27811
2021-12-14 13:49:57 +01:00