CLOUD CONFIG INTERGATION WITH SCSB APPLICATIONS
INITIAL SETUP:
Execute the script which is inside the below two files.
...
...
2. Clone the Phase4-SCSB-Config-Server from the repo , build and run the application.
Make sure the application is running successfully.
BUILD LATEST COMMOM JAR
Clone the Phase4-SCSB-Common and build the project using the below command
./gradlew -DarchiveVersion=1.2 clean build -x test
2.Place the commonjar under /data/commonjar
CHANGES ON THE CLIENT APPLICATIONS:
Add the following depenedencies in the build.gradle.
implementation 'org.springframework.cloud:spring-cloud-starter-config'
implementation 'org.springframework.cloud:spring-cloud-starter-bus-amqp'
implementation 'org.json:json:20200518'
implementation 'com.google.code.gson:gson:2.8.6'
compile fileTree(dir: '/data/commonjar', include: '*1.2.jar')
2. Add the following properties in the application.properties
spring.cloud.config.uri=http://localhost:8888
spring.rabbitmq.host=localhost
spring.rabbitmq.port=5672
spring.rabbitmq.username=guest
spring.rabbitmq.password=guest
USAGE OF PROPERTY RETRIEVAL MECHANISM IN CLIENT APPLICATIONS:
Autowire the PropertyUtil class and call its respective methods to get the desired result.
@RestController
class MessageRestController {
@Autowired
PropertyUtil propertyUtil;
@GetMapping("/ins/{institutionCode}")
Map<String, Object> getValue(@PathVariable("institutionCode") String institutionCode) {
JSONObject json = propertyUtil.getPropertyByInstitution(institutionCode);
Map<String, Object> response = json.toMap();
return response; }} }
You can use the following methods on the PropertyUtil class.
/** To get Specific Instuition property */
public ILSConfigProperties getILSConfigProperties(String institution) {
}
/** To get Specific Instuition property Key */
public String getPropertyByInstitutionAndKey(String institution, String propertyKey) {
}
/** To get Specific Ims location property */
public JSONObject getPropertyByImsLocation(String institution) {
}
/** To get Specific Ims location property Key */
public String getPropertyByImsLocationAndKey(String institution, String propertyKey) {
}