Prepare your computer to write Spring boot code

Important note:

The following instructions are for the Technologies of Internet applications course of DIT (ΤΕΔ) for Spring Boot. The instructions could be used by those who will follow either the Angular/Spring Boot/MySQL stack or the Vue/Spring Boot/MySQL stack or the React/Spring Boot/MySQL (with or without JPA).

For the Javascript front-end more steps are needed which are specific to the framework you decide to use.

If you haven’t installed java yet, please install first before proceeding.


Here are the steps:

Initialize the project

1) Select dependencies

Go to the official spring initializer and select the following dependencies:

  1. Spring Web
  2. Spring boot dev-tools
  3. Spring Data (JPA)
  4. MySQL driver
  5. Lombok

2) Select build tool

Recommended is maven.

3) Select packaging

Recommended is jar

4) Select Java version

Recommended is java 8

Generate the project, download and extract the file.

Configure database access

Open application.properties and configure database connection as displayed below:

## MySQL DataSource
spring.datasource.url=jdbc:mysql://localhost:3306/mydb?allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=UTC
spring.datasource.username=bob
spring.datasource.password=bob

Configure jpa

Open application.properties and configure JPA as displayed below:

## JPA/Hibernate
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update # or better: validate
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect

That’s it. Now open the project with any IDE you want (like IDEA, netbeans etc) and build and run the project.

On how to create a REST point you can read this article.

Leave a Reply