Giter Club home page Giter Club logo

spring-boot-fundamentals's Introduction

Spring Boot Fundamentals

Acknowledgements

This is a LEANSTACKS solution.

For more detailed information and instruction about constructing Spring Boot RESTful web services, see the book Lean Application Engineering Featuring Backbone.Marionette and the Spring Framework.

LEANSTACKS offers several technology instruction video series, publications, and starter projects. For more information go to LeanStacks.com.

Repository

This repository is a companion for the LEANSTACKS YouTube channel playlist entitled Spring Boot Fundamentals.

Repository Organization

Each episode of the Spring Boot Fundamentals video series has a corresponding branch in this repository. For example, all of the source code illustrated in the episode entitled Bootstrapping a Spring Boot Application Project may be found on the repository branch named bootstrap.

Branches

bootstrap

The branch named bootstrap contains the source code illustrated in the episode Bootstrapping a Spring Boot Application Project.

restws-1

The branch named restws-1 contains the source code illustrated in the episode Creating RESTful Web Services with Spring Boot - Part 1.

restws-2

The branch named restws-2 contains the source code illustrated in the episode Creating RESTful Web Services with Spring Boot - Part 2.

service

The branch named service contains the source code illustrated in the episode Creating Service Components with Spring Boot.

repository

The branch named repository contains the source code illustrated in the episode Using Spring Data Repositories with Spring Boot.

transactional

The branch named transactional contains the source code illustrated in the episode Declarative Transaction Management with Spring Boot.

cache

The branch named cache contains the source code illustrated in the episode Declarative Cache Management with Spring Boot.

scheduled

The branch named scheduled contains the source code illustrated in the episode Creating Scheduled Processes with Spring Boot.

async

The branch named async contains the source code illustrated in the episode Creating Asynchronous Processes with Spring Boot.

configuration

The branch named configuration contains the source code illustrated in the episode Using Profiles and Properties to Create Environment-Specific Runtime Configurations with Spring Boot.

unit-test

The branch named unit-test contains the source code illustrated in the episode Creating Unit Tests with Spring Boot.

unit-test-controller

The branch named unit-test-controller contains the source code illustrated in the episode Creating Web Service Controller Unit Tests with Spring Boot.

unit-test-mockito

The branch named unit-test-mockito contains the source code illustrated in the episode Creating Web Service Controller Unit Tests with Mockito and Spring Boot.

actuator

The branch named actuator contains the source code illustrated in the episode Production Monitoring and Management with Spring Boot Actuator.

security

The branch named security contains the source code illustrated in the episode Protecting Application Assets with Spring Security - Out-of-the-Box Features.

controller-hierarchy

The branch named controller-hierarchy contains the source code illustrated in the episode Creating Meaningful RESTful Web Service Controller Hierarchies with Spring Boot.

gradle

The branch named gradle contains the source code illustrated in the episode Using the Gradle Build System.

gradle-build-dash

The branch named gradle-build-dash contains the source code illustrated in the episode Introduction to Gradle Project and Build Reports.

gradle-jacoco

The branch named gradle-jacoco contains the source code illustrated in the episode Using the Gradle JaCoCo Plugin for Unit Test Code Coverage Reporting.

gradle-checkstyle

The branch named gradle-checkstyle contains the source code illustrated in the episode Using the Gradle Checkstyle Plugin for Code Style Reporting.

gradle-pmd

The branch named gradle-pmd contains the source code illustrated in the episode Using the Gradle PMD Plugin for Static Code Analysis.

gradle-defaulttasks

The branch named gradle-defaulttasks contains the source code illustrated in the episode Configuring Gradle Default Tasks.

upgrade-140

The branch named upgrade-140 contains the source code illustrated in the episode Upgrading to Spring Boot 1.4.

executable

The branch named executable contains the source code illustrated in the episode Installing a Spring Boot Application on a Server - Part One.

resttemplate

The branch named resttemplate contains the source code illustrated in the episode Using RestTemplate and Spring Boot to Integrate with REST Services.

Languages

This project is authored in Java.

Installation

Fork the Repository

Fork the Spring Boot Fundamentals repository on GitHub. Clone the project to your host machine.

Dependencies

The project requires the following dependencies be installed on the host machine:

  • Java Development Kit 7 or later

and choose one of:

  • Apache Maven 3 or later
  • Gradle 2.12 or later

Running

The project supports Maven and Gradle for build, package, and test workflow automation.

Maven

The following Maven goals are the most commonly used.

spring-boot:run

The spring-boot:run Maven goal performs the following workflow steps:

  • compiles Java classes to the /target directory
  • copies all resources to the /target directory
  • starts an embedded Apache Tomcat server

To execute the spring-boot:run Maven goal, type the following command at a terminal prompt in the project base directory.

mvn spring-boot:run

Type ctrl-C to halt the web server.

This goal is used for local machine development and functional testing. Use the package goal for server deployment.

test

The test Maven goal performs the following workflow steps:

  • compiles Java classes to the /target directory
  • copies all resources to the /target directory
  • executes the unit test suites
  • produces unit test reports

The test Maven goal is designed to allow engineers the means to run the unit test suites against the main source code. This goal may also be used on continuous integration servers such as Jenkins, etc.

To execute the test Maven goal, type the following command at a terminal prompt in the project base directory.

mvn clean test

package

The package Maven goal performs the following workflow steps:

  • compiles Java classes to the /target directory
  • copies all resources to the /target directory
  • executes the unit test suites
  • produces unit test reports
  • prepares an executable JAR file in the /target directory

The package Maven goal is designed to prepare the application for distribution to server environments. The application and all dependencies are packaged into a single, executable JAR file.

To execute the package goal, type the following command at a terminal prompt in the project base directory.

mvn clean package

The application distribution artifact is placed in the /target directory and is named using the artifactId and version from the pom.xml file. To run the JAR file use the following command:

java -jar example-1.0.0.jar

By default, the batch and hsqldb profiles are active. To run the application with a specific set of active profiles, supply the --spring.profiles.active command line argument. For example, to start the project using MySQL instad of HSQLDB and enable the batch process:

java -jar example-1.0.0.jar --spring.profiles.active=mysql,batch

Gradle

The following Gradle tasks are the most commonly used.

bootRun

The bootRun Gradle task performs the following workflow steps:

  • compiles Java classes to the /build directory
  • copies all resources to the /build directory
  • starts an embedded Apache Tomcat server

To execute the bootRun Gradle task, type the following command at a terminal prompt in the project base directory.

gradle bootRun

Type ctrl-C to halt the web server.

This task is used for local machine development and functional testing. Use the assemble or build task for server deployment.

assemble

The assemble Gradle task performs the following workflow steps:

  • compiles Java classes to the /build directory
  • copies all resources to the /build directory
  • prepares an executable JAR file in the /build/libs directory

The assemble Gradle task is designed to allow engineers the means to compile the project and produce an executable JAR file suitable for server environments without executing unit tests or producing other project reports.

To execute the assemble Gradle task, type the following command at a terminal prompt in the project base directory.

gradle clean assemble

build

The build Gradle task performs the following workflow steps:

  • compiles Java classes to the /build directory
  • copies all resources to the /build directory
  • executes the unit test suites
  • produces unit test reports
  • prepares an executable JAR file in the /build/libs directory

The build Gradle task is prepares the application for distribution to server environments. The application and all dependencies are packaged into a single, executable JAR file.

This task is ideal for use on continuous integration servers such as Jenkins, etc. because it produces unit test, code coverage, and static analysis reports.

To execute the build Gradle task, type the following command at a terminal prompt in the project base directory.

gradle clean build

The application distribution artifact is placed in the /build/libs directory and is named using the project name and version from the build.gradle file. To run the JAR file use the following command:

java -jar build/libs/example-1.0.0.jar

By default, the batch and hsqldb profiles are active. To run the application with a specific set of active profiles, supply the --spring.profiles.active command line argument. For example, to start the project using MySQL instad of HSQLDB and enable the batch process:

java -jar build/libs/example-1.0.0.jar --spring.profiles.active=mysql,batch

spring-boot-fundamentals's People

Contributors

mwarman avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.