Skip to content

Set spring boot dev tools as a default feature in forge to match profiles #14921

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 18, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,18 @@
package org.grails.forge.feature.reloading;

import jakarta.inject.Singleton;
import org.grails.forge.application.ApplicationType;
import org.grails.forge.application.generator.GeneratorContext;
import org.grails.forge.build.dependencies.Dependency;
import org.grails.forge.build.dependencies.Scope;
import org.grails.forge.feature.DefaultFeature;
import org.grails.forge.feature.Feature;
import org.grails.forge.options.Options;

import java.util.Set;

@Singleton
public class SpringBootDevTools implements ReloadingFeature {
public class SpringBootDevTools implements ReloadingFeature, DefaultFeature {
@Override
public String getName() {
return "spring-boot-devtools";
Expand Down Expand Up @@ -54,8 +59,18 @@ public boolean isVisible() {
return true;
}

@Override
public boolean shouldApply(ApplicationType applicationType, Options options, Set<Feature> selectedFeatures) {
return true;
}

@Override
public boolean supports(ApplicationType applicationType) {
return true;
}

@Override
public String getDocumentation() {
return "https://docs.spring.io/spring-boot/docs/2.7.12/reference/htmlsingle/#using.devtools";
return "https://docs.spring.io/spring-boot/reference/using/devtools.html";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,11 @@ class GrailsGradlePlugin extends GroovyPlugin {
SourceSet mainSourceSet = SourceSets.findMainSourceSet(project)
it.classpath = mainSourceSet.runtimeClasspath + project.configurations.getByName('console')
it.systemProperty(Environment.KEY, System.getProperty(Environment.KEY, Environment.DEVELOPMENT.getName()))

// devtools' automatic restart mechanism uses a specialized classloader setup, which can interfere
// with Grails' plugin management and bean wiring when running CLI scripts via Gradle
it.systemProperty 'spring.devtools.restart.enabled', 'false'

List<Object> args = []
def otherArgs = project.findProperty('args')
if (otherArgs) {
Expand Down Expand Up @@ -869,6 +874,10 @@ class GrailsGradlePlugin extends GroovyPlugin {
it.classpath = mainSourceSet.runtimeClasspath + project.configurations.getByName('console')
it.systemProperty(Environment.KEY, System.getProperty(Environment.KEY, Environment.DEVELOPMENT.getName()))

// devtools' automatic restart mechanism uses a specialized classloader setup, which can interfere
// with Grails' plugin management and bean wiring when running CLI commands via Gradle
it.systemProperty 'spring.devtools.restart.enabled', 'false'

List<Object> args = []
def otherArgs = project.findProperty('args')
if (otherArgs) {
Expand Down
Loading