This is a quickstart guide to springboot for Mac.
Pre-requisites:
- Homebrew - https://brew.sh/
- Java 8 - you can use brew or oracle downloads. Some options in this thread: https://stackoverflow.com/questions/24342886/how-to-install-java-8-on-mac
Steps:
brew tap pivotal/tap
brew install springboot
If you have Ruby/Rails, you may encounter issues with conflicts between the spring
gem in Rails and springboot spring
Workaround:
Locate where springboot has been installed, it is usually somewhere like this: /usr/local/Cellar/springboot/1.5.8.RELEASE/
Then set env vars and symlink to springboot
(caveat: you will be running the cli using springboot
instead of spring
)
export SPRING_HOME=/usr/local/Cellar/springboot/1.5.8.RELEASE/
cd /usr/local/bin
ln -sf /usr/local/Cellar/springboot/1.5.8.RELEASE/bin/spring ./springboot
(you may also need to source your ~/.bash_profile or equivalent)
Test this:
springboot --version
Create a directory, e.g. mkdir app
Then add app.groovy
and add the following (creating a Controller)
@RestController
class App {
@RequestMapping("/")
String home() {
"Hello World!"
}
}
Test:
cd app
springboot run app.groovy
curl http://localhost:8080
That's it!