Web Development Using Spring Boot For Beginners

In this series of posts, we are gonna cover tutorial on how to get start web development in Java using spring boot. For your information, I've been working on web developments for quite a while but not using Spring, and not using Java either, so it's kinda like i am also newbie as you are, but don't worry all codes on this website will be tested so that it will work when you copy/pasting. And because it's for beginners, all codes on this series would be full single class file, no cut.

Follow these steps to get started web development in Spring.

1. Prepare your favorite IDE
It is Java not Javascript, you are gonna write enterprise level codes, in other to have readable, maintainable codes, you need to have better tools, IDE helps you refactoring your code, code completion, and building your code with a press of a button, usually hammer icon.

2. Initialize spring boot project
Simply using start.spring.io, you can create your project template, all you need to do is specifying project meta data, dependencies you want to use, etc.

Add dependencies, i will recommend these dependencies for your starter:

Web, JPA, MySQL, devtools

Then download the zip file given, extract the file to where you usually placed your projects

3. Build the project
I suggest open a terminal or cmd, then locate using cd command, for example

cd your-spring-project


mvn clean install

4. Start using IDE
Open your project from your IDE, because you already build the project on the step 3, the IDE usually not compiling your project again, so it will open your project faster.

5. Set database configuration
If you include MySQL dependencies, you must change the application.properties, located on your-project/src/main/resources at minimal have these MySQL configuration:


6. Run the projects
Switch to cmd again, and don't forget to locate to your project directory using cd command, then using this command to run the project, and don't close it.

mvn spring-boot:run

Now you are ready to develop your spring boot application using your favorite IDE, every change you made, just build the project by click the hammer button, it will auto reload your project because you have devtools on your pom.xml.

You can check using your favorite browser, go to http://localhost:8080 to make sure your project is running.

Popular posts from this blog

Spring Kafka - how to use ReplyingKafkaTemplate send and reply synchronously

ERROR 1348 Column Password Is Not Updatable When Updating MySQL Root Password

Intellij Error: Spring class file has wrong version 61.0, should be 55.0

How To Create Spring Boot Project Using Netbeans

How To Use React Ckeditor Upload File Image With Demo and Example Codes