Please refrain from merging branches. The main branch serves as the structure for a Spring Boot application, while each individual branch represents a specific app. These apps are developed based on the main branch and are crafted with the assistance of GitHub Copilot.
We are going to create a restful API using Java and Spring Boot. We will use GitHub Copilot to help us write the code. The Api will be a simple CRUD application that will allow us to create, read, update and delete employees from a database.
For writing the code and documentation, I am getting help from GitHub Copilot.
GitHub Copilot is an AI pair programmer that helps you write code faster. It is available as IDE extensions. It is also available in other IDEs. You can learn more about GitHub Copilot here.
There are 2 types of copilot extensions:
- GitHub Copilot for in-editor suggestions
- GitHub Copilot for chat suggestions
This is a Java Spring Boot application. The application has following depndencies:
- Spring Web
- Spring Data JPA
- h2 Database
in the branch api
we will create a restful API that will allow us to create, read, update and delete employees from a database.
I utilized the Spring Boot Initializr to generate the structure of this application. This tool provides a straightforward web UI that enables you to configure your application's foundational aspects. Within the web UI, you have the option to specify the language, project type, Spring Boot version, and add the necessary dependencies.
I used GitHub Copilot to write the code and documentation. I used Copilot suggestions in the editor
and via chat
.
I used these 2 methods to get help from Copilot:
- Copilot suggestions in the editor
- Copilot suggestions in the chat
Copilot suggests code in the editor in the following ways:
- When I write a comment, Copilot suggests code based on the comment.
- When I write a method, Copilot suggests the method body.
- Autocomplete suggestions based on the context.
- Inline chat suggestions.
- Explaination of the code.
- Fix the code
- Generate codes
- Generate test
I can ask questions and Copilot suggested code based on the question. very similar to the in-editor suggestions.
- Java 17
- Maven
- IDE - I used Visual Studio Code please refere to list of Copilot supported IDEs here
- h2 database - I used h2 database for this application. You can use any other database as well.
- Postman - for testing the API
- Git - for version control
- GitHub - for hosting the code
- Copilot - for writing the code and documentation
Most of suggested codes are in-editor suggestions, I use comments to get suggestions and you can see the comments in the code and try to reproduce the same in your code.
You can follow the instructions in Getting Started.
You have freedom to accept or deny the suggested code, or modify the code either manually or ask Copilot to modify it itself.