Skip to content

Instantly share code, notes, and snippets.

@claritee
Last active November 5, 2017 05:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save claritee/52361a5617c0c247663c3b3969d24185 to your computer and use it in GitHub Desktop.
Save claritee/52361a5617c0c247663c3b3969d24185 to your computer and use it in GitHub Desktop.
Quick Start: SpringBoot Command Line Setup & Test

What Is This?

This is a quickstart guide to springboot for Mac.

Installation

Pre-requisites:

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

Test App

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment