我需要将以下 JSON 转换为 Java 对象。该物业providerResponse在JSON包含的属性的地图,但他们逃脱了,并包裹在双引号。因此,它不会将属性反序列providerResponse化为 Java 对象(它作为String)。我objectMapper.readValue(msgStr, classType)用来反序列化 JSON。该消息由 AWS 生成,用于 SNS 传送状态通知,我无法控制更改 JSON 消息。是否可以配置ObjectMapper为取消转义属性并反序列化为 Java 对象而不是String?
{
"delivery":{
"providerResponse":"{\"sqsRequestId\":\"308ee0c6-7d51-57b0-a472-af8e6c41be0b\",\"sqsMessageId\":\"88dd59eb-c34d-4e4d-bb27-7e0d226daa2a\"}"
}
}
@JsonProperty("providerResponse")
private String providerResponse;
Run Code Online (Sandbox Code Playgroud) 我尝试将 sonarqube (7.6) 配置为使用 postgresql 数据库,它似乎忽略了 sonar.properties 中的条目并选择了 H2 数据库。当我将属性作为 jvm 参数传递时,它会正常工作。如何配置声纳以使用 sonar.properties 中的 postgres
声纳.属性:
sonar.jdbc.username=myuser
sonar.jdbc.password=mypwd
sonar.jdbc.url=jdbc:postgresql://ipaddress:5444/mypostgres
sonar.log.level=DEBUG
Run Code Online (Sandbox Code Playgroud)
日志片段:
2019.03.25 05:42:03 INFO web[][o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [127.0.0.1:9001]
2019.03.25 05:42:03 INFO web[][o.s.s.p.LogServerVersion] SonarQube Server / 7.6.0.21501 / d56689a5eb122c06cf87375828085609f5a68323
2019.03.25 05:42:03 INFO web[][o.s.s.p.d.EmbeddedDatabase] Starting embedded database on port 9092 with url jdbc:h2:tcp://127.0.0.1:9092/sonar
2019.03.25 05:42:03 INFO web[][o.s.s.p.d.EmbeddedDatabase] Embedded database started. Data stored in: /opt/sonarqube/data
2019.03.25 05:42:03 INFO web[][o.sonar.db.Database] Create JDBC data source for jdbc:h2:tcp://127.0.0.1:9092/sonar
2019.03.25 05:42:03 WARN web[][o.s.db.dialect.H2] H2 database …Run Code Online (Sandbox Code Playgroud) 我有一个cloudformation模板,该模板使用由lambda函数支持的自定义资源。lambda函数的参数之一是字符串列表。我只有一个项目要传递到列表中,并且想使用Fn:Join串联创建字符串。但是,使用Fn :: Join会导致错误,因为它导致无效的json。任何输入表示赞赏。
“订阅”:[“ Fn :: Join”:[“:”,[“ a”,“ b”,“ c”]]]
调用CreateStack操作时发生客户端错误(ValidationError):模板格式错误:JSON格式不正确。
Cloudformation片段:-
"Resources": {
"MyCustomRes": {
"Type": "Custom::CustomResource",
"Properties": {
"ServiceToken": { "Fn::Join": [ "", [
"arn:aws:lambda:",
{ "Ref": "AWS::Region" },
":",
{ "Ref": "AWS::AccountId" },
":function:LambdaFn"
] ] },
"Version": 1,
"ResourceName": { "Ref": "ResourceName" },
"Subscriptions" : [ "Fn::Join": [ "", [
"arn:aws:sns:",
{ "Ref": "AWS::Region" },
":",
{ "Ref": "AWS::AccountId" },
":Topic1"
] ] ]
}
} },
Run Code Online (Sandbox Code Playgroud)