1. Installing HomeBrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2. Use homebrew to install spring Boot CLI2.1 to introduce Pivotal tap
$ brew tap pivotal/tap
- Note: Tap is a way to add additional warehouses to homebrew, Pivotal is the company behind spring and spring boot;
2.2 Installing the Spring Boot CLI
$ brew install springboot
3. Apply 3.1 A groovy-based spring application
// HelloController.groovy@RestControllerclass HelloController{ @RequestMapping("/") def hello(){ return "Hello World" }}
3.2 Run
$ spring run HelloController.groovy
3.3 Problems occurred "Spring was unable to locate the root of your project. There is no gemfile present in the current directory "
- This is due to the fact that there is also a program called executable in Ruby Gem
spring
3.4 Solution-Environment configuration
iTerm2It's zsh.
sudo vi ~/.zshrc
- Look for the installed spring Boot CLI path and write the following in the ZSHRC file:
export SPRING_HOME="/usr/local/Cellar/springboot/2.0.2.RELEASE"
export PATH=$SPRING_HOME/bin:$PATH
source ~/.zshrc, update the configuration file
- Input
spring --version
- Output
Spirng CLI v2.0.2.RELEASE indicates successful change
References:
- Gemfile error when running App.groovy with Spring Boot CLI
- Several ways to configure the environment variable path (MAC) in bash and zsh
- Spring Boot Combat
Sprinboot CLI Installation (Mac edition)