Skip to content

Breaking Changes. CXBOX Migration Guide to Spring Boot 4.0.7

Before starting the migration, we strongly recommend reviewing all dependency changes and verifying compatibility with your current project configuration. Some changes require manual updates in application settings, dependency management, and custom entity implementations.

The sections below highlight the required adjustments and explain what has changed in the core modules.

What changes

Dependency on Jackson2

We use Jackson2.Migration to Jackson 3 has not been performed yet and is planned after upgrading to Spring Boot 4.3+.

It is necessary to override all places where a dependency on Jackson2 is used.

Add jackson2 to application.yml.

spring:
http:
converters:
preferred-json-mapper: jackson2

spring-boot-starter-web

  <dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-web</artifactId>
  <exclusions>
    <exclusion>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-jackson</artifactId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-jackson2</artifactId>
</dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

spring-boot-starter-websocket

  <dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-web</artifactId>
  <exclusions>
    <exclusion>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-jackson</artifactId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-jackson2</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-websocket</artifactId>
</dependency>

org.springdoc

    <dependency>
      <groupId>org.springdoc</groupId>
      <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
      <version>${springdoc-openapi-starter-webmvc-ui.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-jackson</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.springdoc</groupId>
      <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
      <version>${springdoc-openapi-starter-webmvc-ui.version}</version>
    </dependency>

Dependency on postgres

Minimum Database Version 13.0.

We use dependency on postgres:14.0.

Updated to core module JpaDaoImpl

If you use our standard org.cxbox.model.core.dao.impl.JpaDaoImpl, no changes are required.

Deprecated EntityManager methods were replaced:

Old Method New Method
get() find()
save() persist()
delete() remove()

find()

getSupportedEntityManager(clazz.getName()).unwrap(Session.class).find(clazz, id);
getSupportedEntityManager(clazz.getName()).unwrap(Session.class).get(clazz, id);

persist()

getSupportedEntityManager(Hibernate.getClass(entity).getName()).unwrap(Session.class).save(entity);
getSupportedEntityManager(Hibernate.getClass(entity).getName()).unwrap(Session.class).persist(entity);

remove()

getSupportedEntityManager(clazz.getName()).unwrap(Session.class).delete(o);
getSupportedEntityManager(clazz.getName()).unwrap(Session.class).remove(o);

@GenericGenerator was removed from core

If you use our standard BaseEntity, no changes are required.

In Hibernate 7, the standard @GenericGenerator works incorrectly and is marked for removal. New use @ExtSequenceGenerator

Example:

    @ExtSequenceGenerator(
    parameters = {
    @Parameter(name = SequenceStyleGenerator.SEQUENCE_PARAM, value = "app_seq"),
    @Parameter(name = INCREMENT_PARAM, value = "1")
    }
    )
    public abstract class BaseEntity extends AbstractEntity implements Serializable {

        @Id
        @ExtSequenceId
        @JdbcTypeCode(SqlTypes.NUMERIC)
        @Column()
        protected Long id;
    public abstract class BaseEntity extends AbstractEntity implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "extSequenceGenerator")
    @GenericGenerator(
            name = "extSequenceGenerator",
            type = org.cxbox.model.core.hbn.ExtSequenceStyleGenerator.class,
            parameters = {
                    @Parameter(name = SequenceStyleGenerator.SEQUENCE_PARAM, value = "app_seq"),
                    @Parameter(name = INCREMENT_PARAM, value = "1"),
            }
    )
    @JdbcTypeCode(SqlTypes.NUMERIC)
    @Column()
    protected Long id;

References

hibernate-jpamodelgen was removed from core

hibernate-jpamodelgen has been replaced with hibernate-processor

    <dependency>
      <groupId>org.hibernate.orm</groupId>
      <artifactId>hibernate-processor</artifactId>
    </dependency>
    <dependency>
      <groupId>org.hibernate.orm</groupId>
      <artifactId>hibernate-jpamodelgen</artifactId>
    </dependency>

New dependency to core module org.junit.platform:junit-platform-launcher

A new dependency has been added to the core module: org.junit.platform:junit-platform-launcher for autotests.

New dependency to core module spring-cache

A new dependency has been added to the core module: spring-cache for cache.