Skip to content

DEFRA/cdp-java-backend-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CDP Java Spring Boot backend template.

Docker Compose

A Docker Compose template is in compose.yml.

A local environment with:

  • Floci for AWS services (S3, SQS)
  • Redis
  • MongoDB
  • This service.
  • A commented out frontend example.
docker compose --profile services up --build -d

A more extensive setup is available in github.com/DEFRA/cdp-local-environment

MongoDB

MongoDB via Docker

Run infrastructure services (MongoDB, Floci, Redis):

docker compose --profile infra up -d

MongoDB locally

Alternatively install MongoDB locally:

  • Install MongoDB on your local machine
  • Start MongoDB:
sudo mongod --dbpath ~/mongodb-cdp

MongoDB in CDP environments

In CDP environments a MongoDB instance is already set up and the credentials exposed as enviromment variables.

Inspect MongoDB

To inspect the Database and Collections locally:

mongosh

You can use the CDP Terminal to access the environments' MongoDB.

Testing

Run the tests with:

mvn test

There are also application level ests run by running a full Spring Boot application backed by Testcontainers. These tests do not use mocking of any sort and read and write from the containerized database.

mvn clean verify

Running

Run the application:

mvn spring-boot:run

SonarCloud

Example SonarCloud configuration are available in the GitHub Action workflows.

Dependabot

We have added an example dependabot configuration file to the repository. You can enable it by renaming the .github/example.dependabot.yml to .github/dependabot.yml

About the licence

The Open Government Licence (OGL) was developed by the Controller of Her Majesty's Stationery Office (HMSO) to enable information providers in the public sector to license the use and re-use of their information under a common open licence.

It is designed to encourage use and re-use of information freely and flexibly, with only a few conditions.

About

Git repository for cdp-java-backend-template

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages