Daml and Springboot integration
App Development3 posts76 views2 likesLast activity Aug 2024
DP
Dpk376OP
Aug 2024Guys I’m doing a POC on daml Springboot integration.
- Can anyone give me a simple smart contract on daml
- Now I want to interact this smart contract using Springboot
- I have done this two but I can’t complete fully
- If there is already an implementation on this please give me the GitHub link or else can anyone give me the complete code since I’m doing just a POC on this integration.
- Actually I want to interact through postman
- Kindly help me in resolving this guys
BE
bernhard
Aug 2024Hi @Dpk376 , I’m going to answer your questions one by one.
- Use the create-daml-app or just the skeleton app that you get with
daml newto get hold of some simple smart contracts. - See 3.
- What bit are you struggling with? What have you got working?
- I don’t know whether there’s an open source spring boot Daml project, but using Daml from spring boot is not necessarily different than from vanilla java. You can find java examples here: GitHub - digital-asset/ex-java-bindings: Three examples demonstrating three different approaches to using the Java ledger API bindings
- That shouldn’t be a problem as postman supports gRPC.
- Hope the above helps!
PE
perbergman
Aug 2024When I used
daml new quickstart --template quickstart-java
I got a conflict between the spark-java package and a Jetty version loaded by some Spring dependency.
Here is my working build.gradle:
plugins {
id 'java'
id 'org.springframework.boot' version '3.3.2'
id 'io.spring.dependency-management' version '1.1.6'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(22)
}
}
repositories {
mavenCentral()
}
ext {
set('jettyVersion', "9.4.48.v20220622")
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation('com.sparkjava:spark-core:2.7.2') {
exclude group: 'org.eclipse.jetty', module: 'jetty-server'
exclude group: 'org.eclipse.jetty', module: 'jetty-webapp'
exclude group: 'org.eclipse.jetty.websocket', module: 'websocket-server'
exclude group: 'org.eclipse.jetty.websocket', module: 'websocket-servlet'
}
implementation "org.eclipse.jetty:jetty-server:${jettyVersion}"
implementation "org.eclipse.jetty:jetty-webapp:${jettyVersion}"
implementation "org.eclipse.jetty:jetty-util:${jettyVersion}"
implementation "org.eclipse.jetty:jetty-http:${jettyVersion}"
implementation "org.eclipse.jetty:jetty-io:${jettyVersion}"
developmentOnly 'org.springframework.boot:spring-boot-devtools'
developmentOnly 'org.springframework.boot:spring-boot-docker-compose'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation('com.daml:bindings-rxjava:2.9.3') {
exclude group: 'com.google.protobuf', module: 'protobuf-lite'
}
implementation 'ch.qos.logback:logback-classic:1.3.12'
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
}
springBoot {
buildInfo()
}
bootRun {
systemProperty 'spring.profiles.active', 'default'
}
tasks.named('test') {
useJUnitPlatform()
}
Per