Commit Graph

1219 Commits

Author SHA1 Message Date
Sam Brannen
e3fb0a39a2 Clean up compiler warnings 2023-01-28 21:18:19 +01:00
rstoyanchev
6a6a35a0b9 Support method validation for interface-only proxies
Closes gh-29782
2023-01-27 14:46:22 +00:00
Sébastien Deleuze
57b6f7e494 Infer hints for custom constraint validators
This commit introduces a BeanValidationBeanRegistrationAotProcessor
which adds reflection hints for custom ConstraintValidator discovered
on beans constructors, methods and properties.

Closes gh-29823
2023-01-23 10:15:58 +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
Sébastien Deleuze
4396801933 Add reflection hints for Kotlin reflection on functions
Kotlin reflection API invocation on a specific function
may require iterating on all Java methods to find the right
Kotlin function. As a consequence, this commit adds introspection
hints on the class declared methods for all Kotlin beans since
the impact on the footprint is low.

Closes gh-29663
2023-01-10 14:49:26 +01:00
Sam Brannen
f4bc9ffb98 Reintroduce component index support for Jakarta annotations
Spring Framework 6.0 GA introduced a regression in the component index
support for Jakarta annotations such as @Named and @ManagedBean.

Prior to this commit, @Named and @ManagedBean components were
registered in the component index at build time; however, component
scanning failed to find those component at run time.

This commit updates ClassPathScanningCandidateComponentProvider so that
`jakarta.*` annotation types are once again supported for component
scanning via the component index at run time.

Closes gh-29641
2022-12-06 16:23:31 -05:00
Sam Brannen
e124e802a3 Polishing 2022-12-06 16:23:31 -05:00
Sam Brannen
c24a51323d Reinstate test for JmxUtils.locateMBeanServer() 2022-12-03 18:23:41 -05:00
Sam Brannen
1de9d123a5 Update Javadoc for MBeanTestUtils 2022-11-30 15:15:51 +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
f9f8f2d89e Polishing 2022-11-22 16:27:45 +01:00
Sam Brannen
d0d5730f7f Suppress "removal" warnings in CronSequenceGeneratorTests 2022-11-16 12:30:10 +01:00
Stephane Nicoll
da4b539f20 Stop generating generic type as Object for unresolved generics
Closes gh-29454
2022-11-09 12:00:34 +01:00
Juergen Hoeller
70bb785ed6 Turn nested generic FactoryBean type into resolved Class for fallback match
See gh-29385
2022-11-09 11:24:50 +01:00
Juergen Hoeller
0e9eab55ce Unwrap nested generic type within FactoryBean target type if necessary
Closes gh-29385
2022-11-08 20:22:12 +01:00
Sam Brannen
f26a7dee97 Fix broken tests, update copyright dates, and polish
See gh-29414
2022-11-08 20:07:53 +01:00
Kulwant Singh
b2c8546013 Rely on automatic boxing/unboxing in tests
Closes gh-29414
2022-11-08 19:38:03 +01:00
Sam Brannen
e1010a179f Merge branch '5.3.x'
# Conflicts:
#	spring-context/src/test/java/org/springframework/context/annotation/Gh29105Tests.java
2022-11-08 12:27:40 +01:00
Sam Brannen
dedbbf0a79 Avoid warnings in tests 2022-11-08 12:04:56 +01:00
Sam Brannen
c3fca0a826 Always register root directory for registered resource hints
See gh-29403
2022-10-31 14:21:07 +01:00
Sam Brannen
29f085bd1a Automatically register directories for registered resource hints
When a hint such as `graphql/*.*` is registered for resources that are
looked up via classpath scanning using a pattern such as
`classpath*:graphql/**/*.graphqls`, an appropriate pattern is in fact
registered in the generated `resource-config.json` file for GraalVM
native images; however, classpath scanning fails since GraalVM
currently does not make the `graphql` directory automatically available
as a classpath resource.

This can be very confusing and cumbersome for users since a file such
as `graphql/schema.graphqls` will not be discovered via classpath
scanning even though the file is present in the native image filesystem.

To address this, this commit automatically registers resource hints for
enclosing directories for a registered pattern.

If the GraalVM team later decides to perform automatic directory
registration, we can then remove the code introduced in conjunction
with this issue.

Closes gh-29403
2022-10-30 19:02:39 +01:00
Sébastien Deleuze
a1bc539d80 Support multiple @ImportRuntimeHints in the type hierarchy
This commit copies and adapts the logic from
DefaultListableBeanFactory#findMergedAnnotationOnBean
private method to make it suitable for returning multiple
annotations found in the type hierarchy in order
to support this use case with @ImportRuntimeHints.

Closes gh-29361
2022-10-24 10:56:30 +02:00
Stephane Nicoll
e749cd1ef1 Add constructor introspection hint on Configuration class target
See gh-29358
2022-10-20 12:33:05 +02:00
Juergen Hoeller
5ff5553878 Adapted test for reflection hints on proxied user classes
See gh-29335
2022-10-20 09:35:57 +02:00
Juergen Hoeller
7f1990e64e Merge branch '5.3.x' 2022-10-19 16:27:03 +02:00
Vedran Pavic
fb291379e4 Avoid use of Commons Logging in LoggingCacheErrorHandler public API
At present, creating LoggingCacheErrorHandler with custom logger requires use of Commons Logging API, as the appropriate constructor expects org.apache.commons.logging.Log instance. As Commons Logging is rarely the logging framework of choice in applications these days, interaction with its API might not be desirable.

This commit adds LoggingCacheErrorHandler constructor that accepts logger name and thus avoids leaking out any details about the underlying logging framework.
2022-10-19 13:48:59 +02:00
Stephane Nicoll
82a0154bd1 Expose a system property when AOT processing is running
This commit exposes a "spring.aot.processing" system property when the
AOT engine is running. This can be used by code that need to react
differently when the application is being refreshed for AOT processing.

Closes gh-29340
2022-10-18 18:18:43 +02:00
Sam Brannen
eadb003a8d Introduce builder API for AOT processor Settings
Closes gh-29341
2022-10-18 16:33:16 +02:00
Juergen Hoeller
f4dfe94702 Fallback to ISO-based default java.time type parsing
Closes gh-26985
2022-10-18 12:49:14 +02:00
Sam Brannen
4d44aaf81b Omit deprecation warning for Bean Validation constraint annotations
Prior to this commit, AnnotationTypeMapping logged a warning for the use
of convention-based annotation attribute overrides in composed Bean
Validation constraint annotations, even though those attribute overrides
are not related to Spring.

For example, Hibernate's @URL constraint annotation is meta-annotated
with Bean Validation's @Pattern constraint annotation, and we should not
log a warning in such scenarios.

This commit addresses that by not logging a warning if convention-based
annotation attribute overrides are detected for a composed @Constraint
annotation.

Closes gh-29206
2022-10-17 19:39:02 +02:00
Sam Brannen
f00e4b230f Support method chaining in AbstractAotProcessor.Settings
See gh-29266
2022-10-10 19:09:41 +02:00
Sam Brannen
cad7444afa Introduce Settings container in AbstractAotProcessor
See gh-29266
2022-10-10 18:58:27 +02:00
Stephane Nicoll
4eca87baa3 Handle hints for CGLIB proxies consistently
This commit makes sure that hints are registered for CGLIB proxies even
if the proxy itself is not created. This typically happens when AOT runs
on an existing classpath, and a previous run already created the proxy.

Closes gh-29295
2022-10-10 17:39:26 +02:00
Stephane Nicoll
e8ce86a6f0 Relocate testfixtures 2022-10-10 17:36:11 +02:00
Sam Brannen
b2b3163fae Redesign AOT processors for consistency and simplification
There's currently a considerable amount of overlap between the
implementations of AotProcessor and TestAotProcessor. In addition
AotProcessor is abstract and does not include a main() method; whereas,
TestAotProcessor is concrete and does include a main() method.

To address these issues, this commit:

- Introduces an AbstractAotProcessor base class that AotProcessor and
  TestAotProcessor now both extend

- Moves common properties/functionality to AbstractAotProcessor

- Renames AotProcessor to ContextAotProcessor

- Makes TestAotProcessor abstract like ContextAotProcessor

- Removes the main() method from TestAotProcessor

Closes gh-29266
2022-10-10 16:27:04 +02:00
Sam Brannen
72307bbb20 Polish contribution
See gh-28549
2022-10-07 16:35:55 +02:00
hebo
2434470457 Optimize SpEL and property placeholder support for @Async qualifiers
See gh-27818
Closes gh-28549
2022-10-07 16:22:18 +02:00
Juergen Hoeller
3af0c232b7 ProxyFactoryBean determines actual proxy class in getObjectType()
AopProxy implementations accept empty Advisor chains for early proxy class creation.

Closes gh-29097
2022-10-06 11:54:06 +02:00
Stephane Nicoll
efaee61f31 Harmonize accessors of RuntimeHints API
Closes gh-29269
2022-10-06 09:36:17 +02:00
Stephane Nicoll
2f20d6322b Enable cglib proxy for configuration classes if necessary
This commit updates code generation to customize the instantiation of
a configuration class that requires a proxy. Rather than instantiating
the raw class, the proxy is used.

Closes gh-29107
2022-10-04 16:54:44 +02:00
Sam Brannen
5bff2c7341 Clean up warnings in tests 2022-10-04 16:19:37 +02:00
Brian Clozel
31a84fb38e Temporarily ignore tests until gh-29246 is re-applied
See gh-29246
2022-10-03 14:29:45 +02:00
Stephane Nicoll
0cc3c6b5d1 Add entry point for processing an application ahead-of-time
This commit adds the necessary infrastructure to process an application
using the AOT engine, similar to the existing TestAotProcessor for
processing tests.

This can be used by frameworks built on top of Spring Framework, for
instance by providing a main method that can be triggered by build
tools.

Close gh-29181
2022-09-30 16:18:27 +02:00
Stephane Nicoll
e4940149d9 Polish "Replace AotApplicationContextInitializer with interface"
Closes gh-29157
2022-09-30 07:46:00 +02:00