A Corbeans project sample and template originally based on Joel Dudley's yo-cordapp by R3.
This project demonstrates how to apply Corbeans in order to create fully testable webapp/cordapp modules with Spring Boot and Corda. It also demonstrates some approaches towards more maintainable code using the following projects:
- Lean State for auto-generating ContractState / PersistentState mappings
- Partiture for component-based Flows
- Vaultaire for auto-generating data access services, DTOs, query DSL and RSQL support for your Corda states
- Corda RPC PoolBoy for RPC connection pooling
- Corda Testacles for testing with MockNetwork, Node Driver, or Docker
> For Windows, use `gradlew.bat` instead of `./gradlew`
- Start by cloning the
corbeans-yo-cordapptemplate
git clone https://github.com/manosbatsis/corbeans-yo-cordapp.git- Navigate to the project directory
cd corbeans-yo-cordapp- Build the project and run unit tests
./gradlew clean build Note that unit tests for the Spring Boot module use the node driver.
You can also use the integrationTest task to execute the same tests
against a Docker-based corda network:
./gradlew clean build integrationTest -x testThis will implicitly call deployNodes as well (see below) and uses
Docker via Testcontainers
(see also Corda Testacles).
Both approaches run the same tests by extending mypackage.server.AbstractRootTest.
- Deploy Corda nodes
./gradlew deployNodes- Run nodes and webserver
Linux/Unix:
cordapp-workflow/build/nodes/runnodesWindows:
call cordapp/build/nodes/runnodes.batYou can also uncomment webPort and webserverJar in build.gradle
to have runnodes launch Spring Boot as well, then browse the API:
http://localhost:8080/swagger-ui.html
- cordapp-contract: States , contracts and tests with MockServices.
- cordapp-workflow: Flows and tests with MockNetwork.
- bootapp-webserver: Spring Boot app with a number of approaches to integration testing.
You can configure nodes, logging and other options for either runtime or testing by editing
server/src/main/resources/application.properties
or server/src/test/resources/application.properties respectively.
If you refactor from mypackage to your actual base package, make sure to update main and test sources
throughout project modules, along with the corbeans.cordappPackages property in both application.properties
files in the bootapp-webserver module.
By default runnodes will only create a single webserver instance.
If a webserver per node is desired, uncomment "PartyB" node's webPort and webserverJar
in cordapp-workflow/build.gradle's Cordform task.