Class MoneyEnvironmentPostProcessor
- All Implemented Interfaces:
org.springframework.boot.env.EnvironmentPostProcessor,org.springframework.core.Ordered
Spring Boot 4 defaults the web message converters and reactive codecs to Jackson 3, but the
Broadleaf money support (BroadleafMoneyModule + zalando jackson-datatype-money)
is Jackson 2. The spring.http...preferred-json-mapper=jackson2 defaults are normally
supplied to most modules by broadleaf-common-extension; this library does not depend on
it, so it ships the same defaults here to remain self-sufficient (e.g. when used standalone or
exercised by its own slice tests).
These defaults only apply under Spring Boot 4, where the JACKSON2 preferred-json-mapper
value (and spring.jackson.use-jackson2-defaults) exist and Jackson 3 is the default.
Under Spring Boot 3.5 the JsonMapper enum has no JACKSON2 constant (Jackson 2 is
already the default), so applying preferred-json-mapper=jackson2 would fail condition
evaluation with No enum constant ... JACKSON2. The defaults are therefore skipped on 3.5,
keeping this library dual-compatible across both Boot lines.
- Author:
- Jeff Fischer
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetOrder()voidpostProcessEnvironment(org.springframework.core.env.ConfigurableEnvironment environment, org.springframework.boot.SpringApplication application) protected booleanWhether the running Spring Boot version supports thejackson2preferred-json-mapper value.
-
Constructor Details
-
MoneyEnvironmentPostProcessor
public MoneyEnvironmentPostProcessor()
-
-
Method Details
-
postProcessEnvironment
public void postProcessEnvironment(org.springframework.core.env.ConfigurableEnvironment environment, org.springframework.boot.SpringApplication application) - Specified by:
postProcessEnvironmentin interfaceorg.springframework.boot.env.EnvironmentPostProcessor
-
getOrder
public int getOrder()- Specified by:
getOrderin interfaceorg.springframework.core.Ordered
-
supportsJackson2PreferredMapper
protected boolean supportsJackson2PreferredMapper()Whether the running Spring Boot version supports thejackson2preferred-json-mapper value. True on Boot 4.x (where Jackson 3 is the default and Jackson 2 must be explicitly preferred); false on Boot 3.5, whoseJsonMapperenum has noJACKSON2constant (Jackson 2 is already the default, so thepreferred-json-mappervalue is unnecessary and would fail condition evaluation).
-