This is a Spring Boot project template that includes commonly used dependencies for building a RESTful web application. The project is pre-configured with Spring Web, Spring Data JPA, Lombok, Spring Boot DevTools, and an H2 in-memory database.
- Spring Web: Enables the development of RESTful APIs.
- Spring Data JPA: Simplifies database interactions with JPA and Hibernate.
- Lombok: Reduces boilerplate code by generating getters, setters, constructors, and more.
- Spring Boot DevTools: Provides hot reloading and enhances the development experience.
- H2 Database: In-memory database for rapid prototyping and testing.
- Java 17 or later
- Maven 3.6+ or Gradle
- IDE (IntelliJ IDEA, Eclipse, VS Code, etc.)
git clone https://github.com/felippeneves/spring-boot-api.git
cd your-repository./mvnw spring-boot:run./gradlew bootRunBy default, the application runs on http://localhost:8080. You can test available endpoints using tools like Postman or cURL.
The project uses an H2 in-memory database. The default configuration is defined in application.properties:
spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.h2.console.enabled=trueAccess the H2 database console at:
http://localhost:8080/h2-console (Use jdbc:h2:mem:testdb as the JDBC URL)
Ensure your IDE has Lombok enabled:
- IntelliJ IDEA: Enable annotation processing in Settings > Build, Execution, Deployment > Compiler > Annotation Processors.
- Eclipse: Install Lombok plugin and restart the IDE.
/src/main/java/com/felippeneves/spring_boot_api
├── controllers # REST controllers
├── domain
│ ├── exceptions # Custom exception handling
│ ├── transaction # Transaction-related entities
│ ├── user # User-related entities
├── dtos # Data Transfer Objects (DTOs)
├── infra # Infrastructure configurations
├── repositories # JPA repositories
├── services # Business logic layer
├── SpringBootApiApplication # Main application entry point
/src/main/resources
├── static
├── templates
├── application.properties # Configuration file
The project uses the following dependencies:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>This project is licensed under the MIT License - see the LICENSE file for details.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.