Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/abhishekomp/post-service

Spring Boot Rest Api with TestContainer(PostgreSQL, H2) for Integration Testing
https://github.com/abhishekomp/post-service

h2-database integration-testing mockmvc postgresql-database spring-profiles testcontainer testcontainers

Last synced: 7 days ago
JSON representation

Spring Boot Rest Api with TestContainer(PostgreSQL, H2) for Integration Testing

Awesome Lists containing this project

README

        

# Spring Boot Rest API

## Start the app

### Using maven command
Navigate to the project directory and run:
`mvn spring-boot:run`

Specify Profile:
`mvn spring-boot:run -Dspring-boot.run.profiles=h2`
`mvn spring-boot:run -Dspring-boot.run.profiles=postgres`

### Using java command
- Make sure to run mvn clean package so that jar file is available.
`java -Dspring.profiles.active=h2 -jar ./target/*.jar`

### Using mvnw command (is basically the same as using the mvn command)
`./mvnw clean package -DskipTests`
`./mvnw spring-boot:run -Dspring-boot.run.profiles=h2`

## Serving static resources (html, external css, and image inside html)
My example (external css + image): http://localhost:8080/html_with_external_css_and_image.html
Basic html: http://localhost:8080/test.html
Basic html: http://localhost:8080/testB.html