小编Ann*_*nna的帖子

MomentJS 日期字符串添加一天

我不明白为什么这个日期被保存为 +1 天:

startdate = "2017-11-29T23:59:59.999Z";
var new_date = moment(startdate).format('DD/MM/YYYY'); // --> gives 30/11/2017
Run Code Online (Sandbox Code Playgroud)

但如果我这样做:

startdate = "2017-11-29";
var new_date = moment(startdate).format('DD/MM/YYYY'); // --> gives the correct date 29/11/2017
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

这是一个 jsfiddle,显示了这一点:http : //jsfiddle.net/jbgUt/416/

谢谢!

date momentjs

5
推荐指数
1
解决办法
4136
查看次数

选中时更改单选按钮的边框颜色

当我选择它时,我希望有一个绿色边框环绕绿色边框.
这就是我所拥有的:

input[type='radio'] {
        -webkit-appearance: none;
        width: 10px;
        height: 10px;
        border-radius: 50%;
        outline: none;
        box-shadow: 0 0 0 2px gray;
    }

    input[type='radio']:before {
        content: '';
        display: block;
        width: 60%;
        height: 60%;
        margin: 20% auto;
        border-radius: 50%;
    }

    input[type='radio']:checked:before {
        background: green;
    }

    .role {
        margin-right: 80px;
        margin-left: 20px;
        font-weight: normal;
    }

    .checkbox label {
        margin-bottom: 20px !important;
    }

    .roles {
        margin-bottom: 40px;
    }
Run Code Online (Sandbox Code Playgroud)

和模板:

<div class="roles">
    <input type="radio" name="role" value="ONE" id="one">
    <label class="role" for="one">ONE</label>
    <input type="radio" name="role" value="TWO" id="two">
    <label …
Run Code Online (Sandbox Code Playgroud)

css radio-button

4
推荐指数
1
解决办法
2万
查看次数

无法实例化[java.util.List]:指定的类是GET请求中的接口

在我的Spring Boot REST API应用程序中,我需要GET通过接受强类型列表作为输入来处理HTTP :

@RestController
public class CusttableController {

    @RequestMapping(value="/custtable", method=RequestMethod.GET)
    public List<MyObject> getCusttableRecords(List<Custtable> customers) {...}
Run Code Online (Sandbox Code Playgroud)

这给了我这个错误:

org.springframework.beans.BeanInstantiationException:无法实例化[java.util.List]:指定的类是接口

我在GET请求中接受Spring Boot中的强类型列表的正确方法是什么?

java rest spring list spring-boot

2
推荐指数
2
解决办法
5063
查看次数

无法使用带参数的构造函数 NO_CONSTRUCTOR 实例化 java.util.Set

我有这个代码:

@NoArgsConstructor
public class localizedInformations implements Serializable {

    @Getter
    @JsonProperty("infos")
    private Map<String, Set<Info>> localizedInfos = new HashMap<>();
}

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class TechnicalInfo implements Serializable {

    private static final long serialVersionUID = -8926217088092761683L;

    private String label;

    private List<String> values;
}
Run Code Online (Sandbox Code Playgroud)

在执行findAllmongo 操作时的某个时刻,我收到此错误:

Failed to instantiate java.util.Set using constructor NO_CONSTRUCTOR with arguments
Run Code Online (Sandbox Code Playgroud)

你能看出问题出在哪里吗?

谢谢!

java spring mongodb lombok

1
推荐指数
1
解决办法
6731
查看次数

忽略 Elasticsearch 中的空格

对于我的搜索,我想考虑到该"space"字符在过滤器请求中不是必需的这一事实。
例如:
当我过滤时,"THE ONE"我会看到相应的文档。
就算写了也想看"THEONE"
这就是我今天构建查询的方式:

boolQueryBuilder.must(QueryBuilders.boolQuery()
     .should(QueryBuilders.wildcardQuery("description", "*" + 
         searchedWord.toLowerCase() + "*"))
     .should(QueryBuilders.wildcardQuery("id", "*" + 
         searchedWord.toUpperCase() + "*"))
     .should(QueryBuilders.wildcardQuery("label", "*" + 
         searchedWord.toUpperCase() + "*"))
     .minimumShouldMatch("1"));
Run Code Online (Sandbox Code Playgroud)

我想要的是添加这个过滤器:(用 ElasticSearch 编写一个忽略空格的自动完成器

"word_joiner": {
  "type": "word_delimiter",
  "catenate_all": true
}   
Run Code Online (Sandbox Code Playgroud)

但我不知道如何使用 API 做到这一点。任何的想法?
谢谢!

编辑:按照@raam86 的建议,我添加了自己的自定义分析器:

{
    "index": {
      "number_of_shards": 1,
      "analysis": {
        "filter": {
          "word_joiner": {
            "type": "word_delimiter",
            "catenate_all": true
          }
        },
        "analyzer": {
          "custom_analyzer": {
            "type": "custom",
            "tokenizer": "standard",
            "filter": [
              "word_joiner"
            ] …
Run Code Online (Sandbox Code Playgroud)

elasticsearch spring-data-elasticsearch

1
推荐指数
1
解决办法
5342
查看次数