Zach Cochran
by Zach Cochran
2 min read

Categories

Tags

Started working through a spring boot tutorial today. I’ve got some books in the mail for other related Java stuff but I was itching to get started with something. I’ll be following along with the tutorial that’s located here over the next few days.

Here are the notes from today’s lessons that I completed:

  • Spring Boot is a tool that helps us create Spring based Applications
  • It creates something that’s production ready that can just be run
    • Evidently that’s really hard with just normal Spring based applications…

What is Spring?

  • An entire Application FrameWork
  • It’s huge, and has lots of pieces
  • Spring handles a lot under the covers to you, allowing you to focus on the business logic – Lots of things are just tied together via annotations – Things like connecting into the db and other such tasks
  • Requires a lot of setup and configuration steps
  • Many build and deploy steps to get it up and running
  • Spring Boot can be used to abstract all of the overwhelming parts to Spring allowing you to focus on the business logic alone.

Why Use Spring Boot?

  • Focuses on convention over configuration (shoot for the 80% use case)
  • Output is ready to run in a self contained executable container. There isn’t anything else that needs to be done
  • Gives you production ready code.

Maven and pom files

  • Don’t have to download jars, just list out the dependencies
  • pom.xml contains list of the dependencies
  • Maven will go out to the repo and grab each of those dependencies for your
  • Has a tool that will help generate what this file looks like

Creating a new Maven Project

  • Group Id: Package name, identifies the name space
  • Artifact Id: Project Id
  • Need to add the following to the generated pom.xml file to include Spring Boot dependencies ```xml
org.springframework.boot spring-boot-starter-parent 1.4.2.RELEASE
- All of this states that our project is a child of the Spring Boot project
- Our project will inherit from the parent (Spring Boot Starter)
- This one starter will contain all of the opinionated maven configurations for spring
- Also need a set of jars to help with all of web based items
```xml
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
</dependencies>
  • This is a wrapper that contains all of our related jars that we need.
  • We can also define the version of Java that we are using for the project ```xml
1.8

```

💚