Spring boot Part 4 :

Опубликовано: 16 Июль 2026
на канале: GIRISH KUMAR MISHRA
154
0

Step 1 Create DATABASE TABLE

drop database demo;

// Create database inside root then connect with that demo DB and create employee table:

create database demo;

grant all privileges on demo.* to root@localhost;

create table employee ( id INT AUTO_INCREMENT PRIMARY KEY,
first_name varchar(20),
last_name varchar(20),
age int,sex varchar(1),
address varchar(100));

Step 3 Automatic DB connection configuration for spring boot application while it launches
spring.datasource.url=jdbc:mysql://localhost:3306/demo
spring.datasource.username=root
spring.datasource.password=root

spring.jpa.hibernate.use-new-id-generator-mappings=false

Use of some annotation:
Component, Autowired, Entity, Repository, Table,