Try to find an open-source Spring Boot project suitable for beginners
Tags: opensource, java, springboot
Published: 2023-11-17 19:50:22

If you're just starting out and looking to build a variety of applications, including web applications, RESTful services, and microservices, [Spring Boot](https://spring.io/projects/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](https://github.com/search?q=java+spring+stars%3A%3E50+forks%3A%3E50&type=repositories&ref=advsearch) 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](https://github.com/metasfresh/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](https://forum.metasfresh.org/).

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oniqbuko966xbn0xh19u.png)

So I found the [installation](https://docs.metasfresh.org/installation_collection/EN/How_do_I_setup_the_metasfresh_stack_using_Docker) and tried to install the docker and Docker Compose Plugin.  
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uf1xdfu2y2sf6r4v8der.png)


The installation provides the link to [install Docker Compose Plugin](https://docs.docker.com/compose/install/linux/#install-using-the-repository), but I could't find my Mac version, so I searched and got the [doc](https://dockerlabs.collabnix.com/intermediate/workshop/DockerCompose/How_to_Install_Docker_Compose.html) 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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y0e0e030hifwqwcog7na.png)


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](https://github.com/Sunagatov/Online-Store)**
This project looks much simpler and suitable for a beginning, has 19 contributors, 20 issues and updated 18 hours ago.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5qllf38njjoz56lp161e.png)


So I tried to click the START.MD, but the link does not found. Luckily the [START.md](https://github.com/Sunagatov/Online-Store/blob/development/START.md) was easy to found.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qfoanofmpqus0hfqekar.png)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t67mvq23fnaujr7pq9ax.png)


**4. [E-commerce-project-springBoot](https://github.com/jaygajera17/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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kmh6ruff9j3i5u2dm58k.png)


After the previous twists and turns, I nervously began its [installation](https://github.com/jaygajera17/E-commerce-project-springBoot#quickstart):


- 
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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r90xvyikv73g2mv4ugnd.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vgkbl0vbx4zv6spwx5rp.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9qnq79k70xxdmhu9nie0.png)


- 
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](https://stackoverflow.com/questions/6445917/connect-failed-access-denied-for-user-rootlocalhost-using-password-yes) 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!");
    }
}
```

- 
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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2z2xrhyk5fvfspny7u6d.png)

- 
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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cuifp8x5qbxxkp5jq7uw.png)

```
<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>8.0.33</version>
</dependency>
```

- 
Finally, I could run my first Java Spring Boot project finally. I create the [issue](https://github.com/jaygajera17/E-commerce-project-springBoot/issues/38) and [PR](https://github.com/jaygajera17/E-commerce-project-springBoot/pull/39) to fix the bug and update