Skip to content

Improve the Spring Boot integration with Intellij to enable Spring Loaded out of the box. #887

@berlin-ab

Description

@berlin-ab

After some help from @rwinch, we've been able to drop this configuration into our build.gradle, make a change, compile from either our browser or the command line, and see the change made in the application without a restart.

// build.gradle
apply plugin: 'idea'
idea {
   module {
      inheritOutputDirs = false
      outputDir = file("$buildDir/classes/main/")
  }
}

Note:

  • Intellij must be configured to use the same Java version as the command line gradle task.
  • Enable "Make Project Automatically", Intellij will compile your changes after save and they will be available
  • Spring Loaded must be a buildscript dependency

Here's an example project:
berlin-ab/cats@c9ce250

it's on the feature/autoreload branch.

the full build.gradle

// build.gradle
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'spring-boot'

idea {
    module {
        inheritOutputDirs = false
        outputDir = file("$buildDir/classes/main/")
    }
}

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath "org.springframework.boot:spring-boot-gradle-plugin:1.0.2.RELEASE"
        classpath 'org.springframework:springloaded:1.2.0.RELEASE'
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions