Skip to content

Compatibility issue with spring boot 3 / jakarta api #39

@bratkartoffel

Description

@bratkartoffel

Hi,

thanks for this great plugin! AS spring boot 3.0 was released yesterday, I tried to upgrade my project to that new version. This upgrade also includes the change from javax -> jakarta api, which I think breaks this library.

Version 0.2.4 does not work with the jakarta-api:

// this configuration worked fine with boot 2.7.6

@Configuration
public class JacksonNullableModuleConfiguration {
    @Bean
    public JsonNullableModule jsonNullableModule() {
        return new JsonNullableModule();
    }
}
jakarta.servlet.ServletException: Request processing failed: jakarta.validation.UnexpectedTypeException: HV000030: No validator could be found for constraint 'jakarta.validation.constraints.Size' validating type 'org.openapitools.jackson.nullable.JsonNullable<java.lang.String>'. Check configuration for 'password'

	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1011)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:877)

Changing that configuration like proposed by #18 (comment) results in another exception:

@Configuration
public class JacksonNullableModuleConfiguration {
    @Bean
    public JsonNullableModule jsonNullableModule(ObjectMapper objectMapper) {
        JsonNullableModule module = new JsonNullableModule();
        objectMapper.registerModule(module);
        return module;
    }
}
Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'jsonNullableModule': Requested bean is currently in creation: Is there an unresolvable circular reference?
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.beforeSingletonCreation(DefaultSingletonBeanRegistry.java:355)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:227)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)

Can you please make it work with the jakarta-validation annotations as it did with the java-validation annotations?

Thanks,
Simon

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions