Skip to content

ProjectsAndPrograms/crud-spring-boot-thymeleaf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

crud-spring-boot-thymeleaf

Simple crud application to perform basic tasks, that we have to know while learning spring boot.Best practice for beginners.

Features

  1. Image Uplaod
  2. Password encoder
  3. Pagination links
  4. Flash messages
  5. Error pages to handle error code such as 404, 500 etc.

Technolgies Used

  1. Spring-boot 3.0.0
  2. Thymeleaf template engine
  3. Spring data jpa
  4. Spring mvc
  5. MySQL database
  6. Developed in SpringToolSuite4 (STS) IDE

Screenshots

screenshots screenshots
screenshots screenshots
screenshots screenshots

HOW TO USE?

Step-1: Fistly you need to set-up your database. Make sure you have MySQL installed in your PC.
Database Setup : to setup your database you can use the file database/boot_crud_db.sql. using phpmyadmin = if you are using php myadmin then simpley create a new database with the name of 'chat' and then you can import file database/boot_crud_db.sql from your import tab.

using mysql command line client OR workbench - you can simple run the given queries to create your database setup:

creating a database :

CREATE DATABASE boot_crud_db;

using the database :

USE boot_crud_db;

creating database table :

CREATE TABLE `users` (
  `id` bigint(20) NOT NULL,
  `dob` date DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `name` varchar(255) DEFAULT NULL,
  `password` varchar(255) DEFAULT NULL,
  `image` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

add primary key and other constraints :

ALTER TABLE `users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `UK6dotkott2kjsp8vw4d0m25fb7` (`email`);

set the unique id to handle big requests as well:

ALTER TABLE `users`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=40;
COMMIT;

dummy data:

INSERT INTO `users` (`id`, `dob`, `email`, `name`, `password`, `image`) VALUES
(20, '2024-02-23', '[email protected]', 'Raj kumar', '$2a$10$NI5IFvnLxpXlkjSplgsB2e2bOjHkEHtCZ7kfVzdRDPTVpJk9WH.Iu', 'cfb47473-369c-4be9-b3d0-a2bdbcdcfe38.jpg'),
(21, '2024-01-31', '[email protected]', 'SpaceX', '$2a$10$9Oal.rc7J/0qewwsPbFOIuNgjTNGMRE2Zh1nxmY0CRTsiEK1IFRFO', 'adefefb9-b7c6-43d6-a661-c4a1ae42cc53.png');

Step-2: open your STS IDE import this project as an existing maven project
file->import->existing maven project-> choose project folder and hit enter

This will open that project in your ide

Step-3: To run this application firstly you need to update your build and update your newly opened maven project.
To do this right click on your project -> build project
after this in order to update your maven project, again right click on your project-> maven -> update project

Step-4: Now you are ready to run this crud-application
right click on this java class => src/main/java/com/crudapp/SpringBootCrudApplication.java -> Run As -> Spring boot application
It will take few seconds to launch the applications. after launching you can browser this url [ http://localhost:8080] on your browser to show application


NOTE - if you are configuring this type of project first time, you may face many errors, my suggestion is - to run application - and check the browser with this URL [ http://localhost:8080] . If this page is available that means your errors are minor and you are able to run this applicaton
In my case this is working just fine!

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.