buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.gretty:gretty:+'
}
}
apply plugin: 'org.gretty'
repositories {
jcenter()
}
gretty {
springBoot = true
}
Since version 0.0.24 Gretty supports Spring Boot web-apps out-of-the-box. All Gretty features, including (but not limited to) debugging, code coverage and integration tests, also apply to spring-boot web-apps. See more information below.
Add the following code to "build.gradle":
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.gretty:gretty:+'
}
}
apply plugin: 'org.gretty'
repositories {
jcenter()
}
gretty {
springBoot = true
}
Now you can run your Spring Boot application with the command gradle appRun
.
The complete sources for the simplest Gretty Spring Boot setup:
Add the following code to "build.gradle":
buildscript {
repositories {
jcenter()
maven { url 'http://repo.spring.io/release' }
}
dependencies {
classpath 'org.gretty:gretty:+'
}
}
apply plugin: 'org.gretty'
repositories {
jcenter()
maven { url 'http://repo.spring.io/release' }
}
gretty {
springBoot = true
springBootVersion = '1.1.7.RELEASE'
}
Note that spring-boot versions prior to 1.1.0 are not supported by Gretty and may produce compile-time or runtime errors.
Gretty configuration also applies to spring-boot projects. You can set properties like "contextPath", "port", etc. etc. - they all will be passed to the servlet container and web-app.
Gretty uses spring-loaded library for smooth reload of running Spring Boot applications. As soon as you change the sources, the project gets automatically recompiled and web-app reloads with updated classes.
Gretty also supports Fast reload feature with Spring Boot web-apps.
Webapp-overlays are technically possible with Gretty and Spring Boot, but author of Gretty plugin did not test this feature yet. See more information in Web-app overlays section.
Gretty fully supports HTTPS with Spring Boot web-apps.
Gretty fully supports debugging of Spring Boot web-apps.
Gretty fully supports integration tests with Spring Boot web-apps.
Gretty fully supports Jacoco code coverage with Spring Boot web-apps.
Gretty fully supports logging of Spring Boot web-apps.
Gretty fully supports Jetty security realms with Spring Boot web-apps.
Gretty fully supports jetty.xml with Spring Boot web-apps.
Gretty fully supports jetty-env.xml with Spring Boot web-apps.
Gretty fully supports Tomcat security realms with Spring Boot web-apps.
Gretty supports running multiple web-apps on so-called farms. Web-apps can be Spring Boot or "normal", in any combinations - Gretty will sort them out.
Gretty contains example program, showing multi-web-app setup with Spring Boot:
Gretty supports running Spring Boot web-apps on Jetty 8/9 and Tomcat 7/8. Running Spring Boot on Jetty 7 is not supported, since Jetty 7 uses older servlet API not compatible with Spring Boot.
The servlet container for Spring Boot web-apps is selected via servletContainer property of Gretty configuration.