MSSE SENG 5199

Course Materials for the MSSE Web Application Development Course

autoscale: true theme: Next, 3

Web Services / Spring Boot Intro

Adam Keyser

adam.keyser@gmail.com


Agenda


Spring


Spring - Goals


Configuration


How it works

  1. Classpath scanning
  2. Create objects with defined annotations
  3. Objects are placed into container (Application Context)
  4. Servlet tie in to Application Context (Web Application Context)

Spring Bean lifetime types


Spring Bean Stereotypes



Spring Boot


Guiding Philosophy:


Convention over configuration


Key components


Spring Boot Isn’t



Included servlet container for running applications


Spring Boot Internals


Spring Boot starter modules


Spring CLI


Installing the Spring Boot CLI

> curl -s "https://get.sdkman.io" | bash
> sdk install springboot

Test it out

> spring --version

Demo

@RestController
class HelloController {
	@RequestMapping("/hello/{name}")
	def hello(@PathVariable String name) {
		return [greeting: "Hello, " + name + "!" ]
	}
}
> spring run HelloController.groovy

Creating Spring Boot projects

Many ways to start a spring project

> spring init --dependencies=web,data-jpa --build gradle --language groovy my-project

Creating Spring Boot projects (IntelliJ)


Building Spring Boot


Gradle


Cont.


Configuration files


Dependency Management


Maven Scopes


Using Gradle