有没有办法使用 npm 实现这一目标?目前我手动执行此操作,使用与 npm install --save 类似的方法会很好
我发现了一些旧的讨论和提交,但似乎没有成功:
我正在使用OffsetDateTime对象.
我想以ISO格式输出这种类型,所以我已经将上述属性添加到我的application.yml中,当我在我的控制器中使用它时它工作正常.
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Schedule
{
private OffsetDateTime time;
private String mode;
}
Run Code Online (Sandbox Code Playgroud)
在我的控制器中使用:
public ResponseEntity taskManagerTest() {
Schedule bpTaskManagerRequest = new Schedule();
return ResponseEntity.status(HttpStatus.CREATED).headers(null).body(bpTaskManagerRequest);
}
Run Code Online (Sandbox Code Playgroud)
我返回对象时的示例结果:
{
"time": "2017-11-12T15:03:05.171Z",
"mode": "eSetTime"
}
Run Code Online (Sandbox Code Playgroud)
但是如果我使用相同的对象在我的Spring服务中使用RestTemplate进一步发送它:
HttpEntity<Schedule> httpEntity = new HttpEntity<>(bpTaskManagerRequest, headers);
ResponseEntity<String> answer = restTemplate.exchange(bpTaskManagerURL, HttpMethod.POST, httpEntity,
String.class);
Run Code Online (Sandbox Code Playgroud)
它被序列化为:
{
"time": 1510498985.171000000,
"mode": "eSetTime"
}
Run Code Online (Sandbox Code Playgroud)
我的RestTemplate定义为:
@Autowired
private RestTemplate restTemplate;
Run Code Online (Sandbox Code Playgroud)
application.yml片段:
spring:
jackson:
serialization:
write-dates-as-timestamps: false
Run Code Online (Sandbox Code Playgroud)
build.gradle片段:
buildscript {
ext {
springBootVersion = '1.5.4.RELEASE'
ext.kotlin_version = '1.1.51'
}
}
compile('com.fasterxml.jackson.module:jackson-module-parameter-names') …Run Code Online (Sandbox Code Playgroud) 举个例子,我有一句话:
if (ProPref.get("kcstcli","manageesw","on").equals("on")) {
Run Code Online (Sandbox Code Playgroud)
我想提取:
"kcstcli","manageesw","on"
Run Code Online (Sandbox Code Playgroud)
我尝试了非贪婪的解决方案,但它不能很好地工作(我正在使用Groovy).
it =~ /ProPref.get\((.*)?\)/
Run Code Online (Sandbox Code Playgroud)