Open Contract - Integration
Steps to Implement OpenContract Library Inside Services
Step 1: Clone the Repository
- Clone the
navida-pro-be-open-contract
repository locally. - Build the service.
- Publish it to Maven Local.
Step 2: Modify build.gradle
File
- Include OpenContract dependencies.
implementation 'org.navida.be.opencontract:navida-pro-be-open-contract:+'
- Add mavenLocal() inside repositories block to import OpenContract from the local Maven repository:
repositories {
jcenter()
mavenCentral()
mavenLocal()
}
Step 3: Update Values.yml
- Add the following property:
env:
audit-log-exception-save-request-topic-name: audit-log-exception-save-request
Step 4: Modify the Spring Boot Application Class
- add "org.navida.opencontract"(OpenContract package name) for component scanning inside the main class.
@SpringBootApplication(
nameGenerator = FullyQualifiedAnnotationBeanNameGenerator.class
)
@ComponentScan(
basePackages = {"org.navida.pro", "org.navida.pro.controller" , "org.navida.pro.configuration", "org.navida.opencontract"},
nameGenerator = FullyQualifiedAnnotationBeanNameGenerator.class
)
Step 5: Update Main method to display open contract version information
@Slf4j
public class NavidaProBeAuditService {
public static void main(String[] args) {
SpringApplication.run(NavidaProBeAuditService.class, args);
**String openContractVersion = BusinessLogger.class.getPackage().getImplementationVersion();
log.info("Open Contract Version: {}", openContractVersion);**
}
}
-
Include below code in application.properties for local build
audit-log-exception-save-request-topic-name = audit-log-exception-save-request
spring.profile.active=local (This will helps to build local kafka) -
Build & start the application.