ibm-developer / ibm-cloud-spring-bind Goto Github PK
View Code? Open in Web Editor NEWWARNING: This repository is no longer maintained
WARNING: This repository is no longer maintained
While debugging #8 there really was no other option than to clone the affected classes into the application project and re-instrument them with trace, as there was no other way to determine the paths chosen from the log output, even when configured to output at the finest level.
Eg take this section of code https://github.com/ibm-developer/ibm-cloud-spring-bind/blob/master/src/main/java/com/ibm/cloud/spring/env/CloudServicesConfigMap.java#L106-L126 There's no way to know which of the reasons null
is being returned.
Hard to use this project without documentation describing the format of mappings.json
Some sort of schema & example usages would go a long way to helping this to make sense (either here, or potentially in a common repo shared by this and other users of mappings.json eg, https://github.com/ibm-developer/ibm-cloud-env )
When i bind the service to the application when creating the application using ibmcloud dev create
, the file search pattern in the generated mappings.json is something like this file://localdev-config.json:$.cloudant_url
which does not work and in here i noticed a different format https://github.com/ibm-developer/ibm-cloud-env#mappingsjson-file-example . What is the correct format?
In order for this format to work file://localdev-config.json:$.cloudant_url
, i had to make changes in this line https://github.com/ibm-developer/ibm-cloud-spring-bind/blob/master/src/main/java/com/ibm/cloud/spring/env/CloudServicesConfigMap.java#L269 to this String path = token[0].substring(2);
malformed mappings.json entries such as
"cloudant": {
"credentials": {
"searchPatterns": [
"user-provided:cloudant-test:username",
"cloudfoundry:cloudant",
"env:cloudant_credentials",
"file:/server/localdev-config.json:cloudant_credentials"
]
}
}
Cause project start up to fail with an NPE
Caused by: java.lang.NullPointerException
at com.ibm.cloud.spring.env.CloudServicesConfigMap.getValue (CloudServicesConfigMap.java:128)
at com.ibm.cloud.spring.env.CloudServicesPropertySource.getProperty (CloudServicesPropertySource.java:39)
at org.springframework.boot.context.properties.source.SpringConfigurationPropertySource.find (SpringConfigurationPropertySource.java:111)
Seemingly because the code makes an assumption that there will always be an immediate child of a mappings.json entry called searchPatterns
and does not test for the situation where that does not exist.
in this case the malformed json has 'credentials' as the child, which means this code
https://github.com/ibm-developer/ibm-cloud-spring-bind/blob/master/src/main/java/com/ibm/cloud/spring/env/CloudServicesConfigMap.java#L127-#L128
fails because 'array' ends up as null causing the NPE.
Right now spring-boot-autoconfigure
version being used is 1.5.9.RELEASE
which comes as part of spring boot 1.x. Upgrade the version of spring-boot-autoconfigure
to use the latest that supports spring boot 2.x
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.