Get ahead
VMware offers training and certification to turbo-charge your progress.
Learn moreHi, Spring fans! Welcome to another installment of This Week in Spring! It's Tuesday, and you know what that means? I'm thinking about production. Now, to be fair, I'm always thinking about production. But recently, I've been spending the weekend just overjoyed at how simple it was to get Cloud Foundry working on my laptop, in Docker, with this GitHub repository. You see, I normally rely on an internal cluster at work to try out the latest and greatest in the platform, but I've always wanted to run the whole thing locally. It's like four steps. But don't even do those steps. Instead, just launch your favorite AI and point it to the instructions. You'll just need to have Docker and kind running on your host, and your AI agent will take care of the rest. I used Claude, but you do you. Why do I mention this? I love Cloud Foundry. It's like if you took the ideals of Spring Boot and applied them to a platform where your applications run. Strong opinions, loosely held. The platform and the framework, combined, let me focus on the important stuff: getting to production.
You wanna try it out? Why not!
First, install Cloud Foundry in kind as explained above.
Second, install the cf CLI.
brew install cloudfoundry/tap/cf-cli@8
# Using Chocolatey
choco install cloudfoundry-cli
# Or using Winget
winget install CloudFoundry.cli
curl -L "https://packages.cloudfoundry.org/stable?release=linux64-binary&version=v8&source=github" | tar -zx
# Move to your path
sudo mv cf8 /usr/local/bin/cf8
sudo mv cf /usr/local/bin/cf
Third, build a Spring Boot application. Hit the Spring Initializr and create a new application using Java 17, and add Web. Here's what I put at the bottom of my DemoApplication class:
@Controller
@ResponseBody
class HelloController {
@GetMapping("/")
Map<String, String> hello() {
return Map.of("name", "Hello, Cloud Foundry!");
}
}
Then in the command line:
./mvnw package && cd target && cf push -p *jar myapp
After 30 seconds or so, it'll be done and you can interrogate the application with:
cf applications
TIP: you could also use cf a as an alias for cf applications.
You'll see the URL of the application in the output. Bring up the application and you're off to the races!
Anyway, enough chit-chat about my new obsession... let's dive into this week's roundup!