This repository is a playground for learning and trying new ideas with Spring Boot
- Java Version: OpenJDK 21 (Execute java -version in command line after installation)
- Apache Maven Version: 3.9.5 (Execute mvn -version in command line after installation)
- Colima or Docker Desktop for Mac, Linux or Windows: latest
- Docker Cli Version: latest (
docker --version
) - Docker Compose Version: latest (
docker compose version
) - Git Client: Any latest version (
git --version
) - Integrated Development Environment: Any version IntelliJ Idea or Eclipse
Docker dependencies needs to be started using docker compose before the build
docker compose -f docker_local/docker-compose.yml pull
docker compose -f docker_local/docker-compose.yml up --build -d
docker compose -f docker_local/docker-compose.yml down -v
- Start Postgresql database through docker (steps given below)
- Execute
mvn clean install
Will skip unit tests, integration tests and docker commands
mvn clean install -DskipTests=true
mvn clean spring-boot:run -pl JdbcExample/JdbcApplication
Open URL in browser:
http://localhost:8180/swagger-ui.html
mvn versions:use-latest-versions
mvn versions:use-latest-releases
mvn versions:use-latest-snapshots
mvn versions:update-properties
mvn versions:update-child-modules
mvn versions:update-parent
- Open terminal in root folder
- Execute the following to start rest third party stub and service
mvn exec:exec@run-third-party antrun:run@wait-for-ping spring-boot:run -pl RestExample/RestServiceAndConsumer
- Verify all applications are running
curl --header "Content-Type: application/json" -X GET "http://localhost:8080/quote"
docker logs -t -f springboot-jdbc-postgres
docker run --network=docker_local_main -it --rm -e PGPASSWORD=superpassword postgres:10 psql --host springboot-jdbc-postgres --username myuser --dbname myuser --port 5432
Type '\q' to quit the terminal and container
docker build --pull -t com.harishkannarao/spring-boot-jdbc:latest -f JdbcExample/JdbcApplication/Dockerfile JdbcExample/JdbcApplication/target
Run without jmx
docker run --network=docker_local_main -e SSH_PUBLIC_KEY -e 'REMOTE_JMX_OPTIONS=' -e 'THIRDPARTY_PING_URL=http://www.example.org' -e 'APP_DATASOURCE_HIKARI_JDBC_URL=jdbc:postgresql://springboot-jdbc-postgres:5432/myuser' -e 'APP_DATASOURCE_HIKARI_USERNAME=myuser' -e 'APP_DATASOURCE_HIKARI_PASSWORD=superpassword' --rm -it --name spring-boot-jdbc -p '10022:22' -p '10006:10006' -p '8180:80' com.harishkannarao/spring-boot-jdbc:latest
Run with jmx
docker run --network=docker_local_main -e SSH_PUBLIC_KEY -e 'REMOTE_JMX_OPTIONS=-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=10006 -Dcom.sun.management.jmxremote.rmi.port=10006 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.local.only=false -Djava.rmi.server.hostname=localhost' -e 'THIRDPARTY_PING_URL=http://www.example.org' -e 'APP_DATASOURCE_HIKARI_JDBC_URL=jdbc:postgresql://springboot-jdbc-postgres:5432/myuser' -e 'APP_DATASOURCE_HIKARI_USERNAME=myuser' -e 'APP_DATASOURCE_HIKARI_PASSWORD=superpassword' --rm -it --name spring-boot-jdbc -p '10022:22' -p '10006:10006' -p '8180:80' com.harishkannarao/spring-boot-jdbc:latest
Sample url
curl -s -X GET 'http://localhost:8180/menuentries'
Swagger / Open API urls:
http://localhost:8180/api-docs
http://localhost:8180/api-docs.yaml
http://localhost:8180/swagger-ui.html
http://localhost:8180/swagger-ui/index.html?configUrl=/api-docs/swagger-config
Set the following secrets for this repo:
- AwsAccountId
- AwsAccessKeyId
- AwsSecretAccessKey
- GithubAccessToken
Execute the following commands:
export GITHUB_PERSONAL_ACCESS_TOKEN=<<your_personal_token>>
curl -v -H "Accept: application/vnd.github.everest-preview+json" \
-H "Authorization: token $GITHUB_PERSONAL_ACCESS_TOKEN" \
--request POST \
--data '{"event_type": "do-deploy-master-to-aws-development", "client_payload": { "transaction_id": "some reference"}}' \
'https://api.github.com/repos/harishkannarao/MySpringBoot/dispatches'