Skip to content

9.7.1

Latest

Choose a tag to compare

@github-actions github-actions released this 02 Nov 01:43
· 1 commit to master since this release

Spring AOT (spring-boot:process-aot, native images) with REST clients (#341):

spring-addons-starter-rest

  • The bean definitions of the clients declared under com.c4-soft.springaddons.rest.client no longer embed the resolved SystemProxyProperties and SpringAddonsRestProperties, which Spring AOT can't write as code (Code generation does not support com.c4_soft.springaddons.rest.SystemProxyProperties). The client factory beans bind them from the environment when they create their client, as the post-processors did when they registered the definitions: same properties, same values, and in an AOT-processed application, the values of the runtime environment.
  • The three bean definition registry post-processors (RestClient, servlet and reactive WebClient) implement BeanFactoryInitializationAotProcessor, which keeps them out of the AOT generated code: in an AOT-processed application, they no longer run at startup, where they registered the clients a second time over the generated definitions (BeanDefinitionOverrideException).
  • With Spring AOT, as for any bean definition, the clients, their type (RestClient or WebClient), whether they expose a builder and whether they use OAuth2 are those of the environment at build time (process-aot profiles and properties); their configuration (base URL, proxy, headers, ...) comes from the runtime environment.

HTTP service groups with a second properties bean (#344):

spring-addons-starter-rest

  • The HTTP service group configurers bind SpringAddonsRestProperties and SystemProxyProperties from the environment, as the clients do since #341, instead of injecting the beans: an application declaring a second bean of either type no longer fails to start with NoUniqueBeanDefinitionException. The groups no longer read these beans: their configuration comes from the com.c4-soft.springaddons.rest properties and from the HTTP_PROXY, HTTPS_PROXY and NO_PROXY environment variables (or their lower-case versions).

spring-addons-starter-recaptcha

  • The auto-configured C4ReCaptchaValidationService no longer fails to start with a second SystemProxyProperties bean, or a second RestClient.Builder bean: a single spring-addons-starter-rest client declared with expose-builder was enough, next to Spring Boot's builder. It binds SystemProxyProperties from the environment instead of reading the bean (the per-service proxy is still set with com.c4-soft.springaddons.recaptcha.http.proxy.*), and uses the application's RestClient.Builder when it is unique or primary, a default builder otherwise.

Native images with reCAPTCHA (#345):

spring-addons-starter-recaptcha

  • The auto-configuration registers the reflection hints Jackson needs to bind the siteverify responses (V2ValidationResponseDto, V3ValidationResponseDto) in a GraalVM native image.

JsonPath functions in native images (#346):

spring-addons-oauth2

  • A RuntimeHintsRegistrar (found by Spring AOT through META-INF/spring/aot.factories) registers the constructors of the JsonPath functions, which JsonPath creates by reflection: a claim path using keys(), first(), concat(), ... (in ClaimSet.getByJsonPath, or an authorities[].path) failed in a native image with Function of name: keys cannot be created.

Method security expressions in native images (#347):

spring-addons-oauth2

  • A RuntimeHintsRegistrar registers the public methods of SpringAddonsMethodSecurityExpressionRoot, which SpEL calls by reflection: with SpringAddonsMethodSecurityExpressionHandler, an expression using this, returnObject (@PostAuthorize) or filterObject failed in a native image (Property or field 'returnObject' cannot be found). The methods an application adds in its own expression root need hints from the application: @RegisterReflection(classes = MyExpressionRoot.class, memberCategories = MemberCategory.INVOKE_PUBLIC_METHODS), as the handler's Javadoc shows.

Documentation and build (#349, #350):

  • A Spring AOT and native images page: what process-aot decides at build time, the runtime hints the libraries contribute and those an application adds, Spring Cloud's refresh scope.
  • The CI processes the samples ahead of time and runs their tests on the generated contexts (the aot profile of the samples).

Available on Maven Central: com.c4-soft.springaddons 9.7.1