Skip to content
Greg Swindle edited this page Nov 11, 2017 · 8 revisions

Spring Boot logo

Note Spring and Maven tips.

Table of contents

Installing the Spring Boot CLI with OSX Homebrew

Note View Spring Boot docs ↗️

$ brew update
$ brew tap pivotal/tap
$ brew install springboot
$ spring help

Create a Spring Boot REST application

Requires a Terminal/command-line interface Open a Terminal/CLI to begin.

  1. Create a a Maven pom.xml file:

    $ atom pom.xml
  2. Copy and paste the following XML into the pom.xml document:

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
       <modelVersion>4.0.0</modelVersion>
    
      <groupId>com.example</groupId>
      <artifactId>myproject</artifactId>
      <version>0.0.1-SNAPSHOT</version>
    
      <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.8.RELEASE</version>
      </parent>
    
      <!-- Additional lines to be added here... -->
      <dependencies>
        <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
      </dependencies>
    </project>
  3. Confirm installation:

    $ mvn dependency:tree

Run a Spring Boot application

Requires a Terminal/command-line interface Open a Terminal/CLI to begin.

  1. From the same directory that hosts your pom.xml file, run:

    $ mvn spring-boot:run
  2. Open a web browser and go to http://localhost:8080.


©️ 2017, Greg Swindle