Skip to content

JPA EntityListeners Autowired fields are null causing NullPointerException after upgrading to Spring Boot 2.3.8 #25153

@nngo

Description

@nngo

We have a JPA @Entity with @EntityListeners(MyJpaListener.class) that have fields that have @Autowired annotations which are properly injected since we have @Configuration, @Bean, and @Component annotations in the right places. This worked fine in Spring Boot 2.3.4 to 2.3.6, but after upgrading to 2.3.7 and 2.3.8, our app is now throwing NullPointerException (NPEs) in our custom JPA Listener for the autowired field. We are also using Hibernate and Postgres. Our Entity Listener has the JPA @PostPersist annotation on the method that is fired where the NPE happens.

We believe there is a change in Spring Data or Spring Data JPA that broke this behavior (doing diff between the Spring Boot 2.3.6 and 2.3.7 POMs show that spring-data-releasetrain.version was upgraded from Neumann-SR5 to Neumann-SR6 which causes this regression.

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