DEV Community

WangGithub0
WangGithub0

Posted on

Try to find an open-source Spring Boot project suitable for beginners

If you're just starting out and looking to build a variety of applications, including web applications, RESTful services, and microservices, Spring Boot might be a more beginner-friendly choice. It has a large and active community, extensive documentation, and a wealth of resources available for learning.

1. Search the project
I used github to search related project and starts>50, forks>50.
After reading the README and About(It is more important than I thought before), I picked some projects.

2. metasfresh
At first, I found the metasfresh project which do open sourse ERP-Fast, Flexible & Free Software to scale your Business. This repo is a good open source which has 2.8k issues, publish a stable Release every Friday and it's has own Community Forum.

Image description

So I found the installation and tried to install the docker and Docker Compose Plugin.

Image description

The installation provides the link to install Docker Compose Plugin, but I could't find my Mac version, so I searched and got the doc which says "Docker Compose is installed as part of Docker for Mac. So if you have Docker for MAC, you have Docker Compose."

Image description

I tried to update my docker-compose.yml, but when I ran docker-compose build, it threw the error docker-compose build
validating metasfresh-docker/docker-compose.yml: (root) Additional property search is not allowed
.

After several hours of searching, I still couldn't resolve this issue. Considering my limited familiarity with ERP and the complexity of this long-standing project, I have decided to temporarily set aside this project. I will revisit it in the future once I have gained more experience with Spring Boot.

3. Online-Strore
This project looks much simpler and suitable for a beginning, has 19 contributors, 20 issues and updated 18 hours ago.

Image description

So I tried to click the START.MD, but the link does not found. Luckily the START.md was easy to found.

Image description

I tried to run docker compose -f docker-compose.services.yml -p online-store-services up -d, but it seems I need a .env file to set it, but I couldn't find enough information to set this .env file. I just wanted to give up this project.
Image description

4. E-commerce-project-springBoot
This project is a web application Java Based Beginner level project To developing the e-commerce website to Buy/sell the Food Item which use the Spring Boot to build the back-end part. And the project forked 279, Stared 265.

Image description

After the previous twists and turns, I nervously began its installation:

  • Open the project in your IDE and change the working directory of the project since Spring Boot doesn't recognize the views. I tried to do according to the first two steps "Click on the "Edit Configurations..." button in the top right corner of the IDE Click on the JtSpringProjectApplication configuration", but I can't find the "JtSpringProjectApplication configuration".... Luckily, I found the way to solve it: when create the project, choose JtProject and choose the Maven, then I can find and set the configuration

Image description

Image description

Image description

  • Configure the database connection in application.properties file. At first, I used db.username=root, but it throws Connect failed: Access denied for user 'root'@'localhost' (using password: YES), at first I set mysql again and again, but it still didn't work. I created a test connect mysql and got the same error, luckily, I found a solution and it worked when I tried to used another mysql account.
package org.example;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class Main {
    public static void main(String[] args) {
        String jdbcUrl = "jdbc:mysql://127.0.0.1:3306/ecommjava";
        String username = "wym";
        String password = "*****";

        try (Connection connection = DriverManager.getConnection(jdbcUrl, username, password)) {
            System.out.println("Connected to the database successfully!");
        } catch (SQLException e) {
            System.err.println("Connection failed. Error message: " + e.getMessage());
            e.printStackTrace();
        }
        System.out.println("Hello world!");
    }
}
Enter fullscreen mode Exit fullscreen mode
  • Then I met another error, boolean cannot be converted to java.sql.ResultSet. Luckily, I found it's a "select" command, and changed it from stmt.execute() to stmt.executeQuery() worked.

Image description

  • Then I met another error, java.lang.IllegalArgumentException: Could not resolve placeholder 'db.driver' in value "${db.driver}. After a lot of searching, I found my db.driver version is not compatible with my mysql version 8.0.31 in pom.xml file, so I set the mysql-connector-java version. One more thing, I need to reload my Maven project.

Image description

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>8.0.33</version>
</dependency>
Enter fullscreen mode Exit fullscreen mode
  • Finally, I could run my first Java Spring Boot project finally. I create the issue and PR to fix the bug and update

Top comments (0)