Livereload with Spring Boot > 3.5.0

I’ve tried multiple project setups using vaadin start, spring initializr, github example repo’s. Every project setup (be it gradle or maven) with Spring Boot > 3.5.0 and Spring Data JPA throws exceptions when trying to inject repositories with CDI and using Debug with HotSwapAgent: “error defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: null”. When downgrading Spring Boot to version 3.5.0 HotSwapAgent works.

Intellij Idea 2024.3.1.1 Ultimate Edition
Vaadin plugin 1.5.1

Spring Boot 3.5.3
Vaadin 24.8.3

Sounds more like an issue on the spring side. Did you consider asking them?

Not yet. I was hoping that someone using Vaadin with JPA, Spring Boot > 3.5.0 with HotSwapAgent encountered this issue and maybe knows how to resolve this. I’ll certainly get in touch with Spring and ask the same question there

See `PersistenceProvider.fromEntityManagerFactory(…)` throws `NullPointerException` using Hotswap Agent · Issue #3923 · spring-projects/spring-data-jpa · GitHub

Thanks. That looks really promising. Can’t believe after hours of searching on internet that i didn’t found that one.
One question (kind of a newbie on java/gradle coming from .NET land):
My build.gradle is using the implementation ‘org.springframework.boot:spring-boot-starter-data-jpa’ dependency but the starter doesn’t have a 4.0.0-* version on maven. If I use the data-jpa (not the starter) from maven (after adding the spring snapshot repo) that does have a 4.0.0-* version then I get errors about java.persistence.

How can I use the org.springframework.boot:spring-boot-starter-data-jpa but override the data-jpa version with the 4.0.0-* version? Is this a transistive dependency?

Never do that! The dependency management comes from Spring Boot parent project.

I’m using Spring Boot 3.5.3 and have no issues. Can you please share your pom.xml

Got it thanks.
By the way when using Spring Boot 3.5.3 using the Run or Debug configuration everything works (including live reload using devtools). The only thing that doesn’t work is using Debug using HotSwapAgent.

I’m using gradle so I’ll post the build.gradle:

buildscript {
    dependencies {
        classpath("org.postgresql:postgresql:42.7.7")
        classpath("org.flywaydb:flyway-database-postgresql:11.10.2")
    }
    repositories {
        mavenCentral()
        maven { setUrl("https://maven.vaadin.com/vaadin-prereleases") }
        maven { setUrl("https://repo.spring.io/milestone") }
        maven { setUrl("https://repo.spring.io/snapshot") }
    }
}

plugins {
    id 'org.springframework.boot' version '3.5.3'
    id 'io.spring.dependency-management' version '1.1.7'
    id 'java'
    id 'com.vaadin'
    id 'io.freefair.lombok' version '8.14'
    id 'org.flywaydb.flyway' version '11.10.2'
}

group = 'xx.xx.xx.xx'
version = '0.0.1-SNAPSHOT'

java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(21)
    }
}

configurations {
    developmentOnly
    runtimeClasspath {
        extendsFrom developmentOnly
    }
}

repositories {
    mavenLocal()
    mavenCentral()
    maven { setUrl("https://maven.vaadin.com/vaadin-prereleases") }
    maven { setUrl("https://repo.spring.io/milestone") }
    maven { setUrl("https://maven.vaadin.com/vaadin-addons") }
}

dependencies {
    implementation 'com.vaadin:vaadin-spring-boot-starter'
    implementation 'org.springframework.boot:spring-boot-configuration-processor'
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    //developmentOnly 'org.springframework.boot:spring-boot-devtools'
    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
    }
    implementation "org.parttio:line-awesome:2.1.0"
    implementation "org.postgresql:postgresql:42.7.7"
    implementation "org.vaadin.addons.themeselect:themeselect:1.0.2"
    implementation 'org.flywaydb:flyway-core'
    implementation 'org.flywaydb:flyway-database-postgresql:11.10.2'
}

dependencyManagement {
    imports {
        mavenBom "com.vaadin:vaadin-bom:$vaadinVersion"
    }
}

flyway {
    url = 'xxx'
    user = 'xxx'
    password = 'xxx'
    schemas = ['xxx']
}

Use 3.5.2-SNAPSHOT for org.springframework.data:spring-data-jpa

Thanks. Adding implementation ‘org.springframework.data:spring-data-jpa:3.5.2-SNAPSHOT’ after implementation ‘org.springframework.boot:spring-boot-starter-data-jpa’ resolved the issue. Was thinking to complex about dependencies