Skip to content
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

Remove doc on removed Groovy support #155

Merged
merged 2 commits into from
Oct 13, 2023
Merged
Changes from all 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
56 changes: 1 addition & 55 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ http://docs.spring.io/spring-boot/docs/{spring_boot_version}/reference/htmlsingl
You can see them all
https://github.com/spring-projects/spring-boot/tree/main/spring-boot-project/spring-boot-starters[here in source code].

== JAR Support and Groovy Support
== JAR Support

The last example showed how Spring Boot lets you wire beans that you may not be aware you
need. It also showed how to turn on convenient management services.
Expand All @@ -360,60 +360,6 @@ deployments but also lets you put together executable JARs, thanks to Spring Boo
module. The various guides demonstrate this dual support through the
`spring-boot-gradle-plugin` and `spring-boot-maven-plugin`.

On top of that, Spring Boot also has Groovy support, letting you build Spring MVC web
applications with as little as a single file.

Create a new file called `app.groovy` and put the following code in it:

====
[source,java]
----
@RestController
class ThisWillActuallyRun {

@GetMapping("/")
String home() {
return "Hello, World!"
}

}
----
====

NOTE: It does not matter where the file is. You can even fit an application that small
inside a https://twitter.com/rob_winch/status/364871658483351552[single tweet]!

Next, https://docs.spring.io/spring-boot/docs/{spring_boot_version}/reference/htmlsingle/#getting-started-installing-the-cli[install Spring Boot's CLI].

Run the Groovy application by running the following command:

====
[source,bash]
----
$ spring run app.groovy
----
====

NOTE: Shut down the previous application, to avoid a port collision.

From a different terminal window, run the following curl command (shown with its output):

====
[source,bash]
----
$ curl localhost:8080
Hello, World!
----
====

Spring Boot does this by dynamically adding key annotations to your code and using
http://www.groovy-lang.org/Grape[Groovy Grape] to pull down the libraries that are needed
to make the app run.

include::https://raw.githubusercontent.com/spring-guides/getting-started-macros/main/build_an_executable_jar_mainhead.adoc[]

include::https://raw.githubusercontent.com/spring-guides/getting-started-macros/main/build_an_executable_jar_with_both.adoc[]

== Summary

Congratulations! You built a simple web application with Spring Boot and learned how it
Expand Down