Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-03-15 12:25:37.668 ERROR 13724 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to bind properties under 'spring.jackson.mapper' to java.util.Map<com.fasterxml.jackson.databind.MapperFeature, java.lang.Boolean>:
Reason: failed to convert java.lang.String to com.fasterxml.jackson.databind.MapperFeature (caused by java.lang.IllegalArgumentException: No enum constant com.fasterxml.jackson.databind.MapperFeature.default-view-inclusions)
Action:
Update your application's configuration. The following values are valid:
ACCEPT_CASE_INSENSITIVE_ENUMS
ACCEPT_CASE_INSENSITIVE_PROPERTIES
ACCEPT_CASE_INSENSITIVE_VALUES
ALLOW_COERCION_OF_SCALARS
ALLOW_EXPLICIT_PROPERTY_RENAMING
ALLOW_FINAL_FIELDS_AS_MUTATORS
ALLOW_VOID_VALUED_PROPERTIES
APPLY_DEFAULT_VALUES
AUTO_DETECT_CREATORS
AUTO_DETECT_FIELDS
AUTO_DETECT_GETTERS
AUTO_DETECT_IS_GETTERS
AUTO_DETECT_SETTERS
BLOCK_UNSAFE_POLYMORPHIC_BASE_TYPES
CAN_OVERRIDE_ACCESS_MODIFIERS
DEFAULT_VIEW_INCLUSION
IGNORE_DUPLICATE_MODULE_REGISTRATIONS
IGNORE_MERGE_FOR_UNMERGEABLE
INFER_BUILDER_TYPE_BINDINGS
INFER_CREATOR_FROM_CONSTRUCTOR_PROPERTIES
INFER_PROPERTY_MUTATORS
OVERRIDE_PUBLIC_ACCESS_MODIFIERS
PROPAGATE_TRANSIENT_MARKER
REQUIRE_SETTERS_FOR_GETTERS
SORT_CREATOR_PROPERTIES_FIRST
SORT_PROPERTIES_ALPHABETICALLY
USE_ANNOTATIONS
USE_BASE_TYPE_AS_DEFAULT_IMPL
application.properties
# database configuration part
spring.datasource.url=jdbc:sqlserver://localhost:<portname>;dataName=<dbname>
spring.datasource.username=
spring.datasource.password=
spring.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.jpa.hibernate.hikari.minimumIdle=5
spring.datasource.hikari.maximum-pool-size=5
spring.datasource.connectionTimeout=3600000
spring.datasource.hikari.idleTimeout=120000
spring.main.allow-bean-definition-overriding=true
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=false
# hibernate settings
spring.jpa.hibernate.use-new-id-generator-mappings=false
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.SQLServer2008Dialect
spring.jpa.hibernate.ddl-auto=update
spring.jackson.mapper.default-view-inclusions=true
how can i resolve this error please help !!
CodePudding user response:
You appear to have a typo in the name of the Jackson mapper property:
spring.jackson.mapper.default-view-inclusions=true
It should be "inclusion", not "inclusions":
spring.jackson.mapper.default-view-inclusion=true
CodePudding user response:
Try using the constant name: spring.jackson.mapper.DEFAULT_VIEW_INCLUSIONS=true
Expanding a bit: the spring.jackson.mapper
configuration is a Map<MapperFeature, Boolean>
, see https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonProperties.java#L77. There is no special magic for converting strings to MapperFeature
constants other than MapperFeature.valueOf
, so that means you need to use the actual constant name. The same goes for the other maps.