Setting up Spring Boot 3 + Maven + MySQL + JDBC Example

In this tutorial we will cover step-by-step how to setup plain JDBC with Spring Boot 3 and Maven and MySQL Database.


Step 1: Downloading the Spring Initializr Project

    Go to start.spring.io and fill in the following information for to download our JDBC project structure.

    Spring initializr setting for Spring Boot 3 + Spring Data JDBC

    Make sure to select Project as Maven and Language as Java, you may choose the latest version of Spring Boot (not Snapshot or Mx versions), for me its 3.0.5

    Do select the Packaging as jar and you may choose any version of Java thats available, I am going with the latest thats Java 20.

    Make sure to click on "Add Dependencies..." and choose Spring Data JDBC

Once all is set, you can click on, Generate button at the bottom to download the project zip file.


Step 2: Importing the JDBC Project to IDE

Quick alternative: you can close the project and be on the Welcome Screen and click on Open and choose your application folder.

Quick Way To Import Spring Project to IntelliJ

Step 3: Setting up MySQL Database.


Step 4: Configuration for MySQL with Spring Boot


Step 5: Creating our CommandLineRunner Class


Step 6: Running your Hello JDBC Project