小编swa*_*thu的帖子

Spring @ConfigurationProperties 不映射对象列表

我在使用 spring 属性映射器时遇到了奇怪的问题。我有 yml 包含值列表。我想将其转换为为什么要构建应用程序的对象列表。所以,我使用了@ConfigurationProperties。有了这个,我就可以映射简单的类型。当我使用它来复杂类型(对象列表)时,它失败了。也不例外,但是当我调试时,值列表为零。请在下面找到 yml 和 java 文件。我试过 spring 2.0.0,2.0.1,2.0.2,2.0.3 没有成功。任何人都可以有想法来解决它吗?

应用程序.yml

acme:
  list:
    - name: my name
      description: my description
    - name: another name
      description: another description
Run Code Online (Sandbox Code Playgroud)

AcmeProperties.java

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

@Component
@ConfigurationProperties("acme")
@PropertySource("classpath:configuration/yml/application.yml")
public class AcmeProperties {

    private final List<MyPojo> list = new ArrayList<>();

    public List<MyPojo> getList() {
        return this.list;
    }

    static class MyPojo {
        private String name;
        private String description;

        public String getName() {
            return name;
        }

        public String …
Run Code Online (Sandbox Code Playgroud)

java spring yaml spring-boot

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

排除某些特定复选框的物化 css

我想在我的视图中排除某些项目的物化 css。例如:我不想在表格下的复选框中显示实体化样式。它会导致我的内部 jquery 库出现问题。请检查附件图片。我在我的表格中给出了以下 html 内容 > td。我想将此显示为浏览器默认复选框。

在我的应用程序中,我使用http://materializecss.com

<div class="checkbox">
    <input type="checkbox" class="filled-in dt-checkboxes">
    <label></label>
</div>
Run Code Online (Sandbox Code Playgroud)

我的带有复选框的表格

html css checkbox materialize

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

标签 统计

checkbox ×1

css ×1

html ×1

java ×1

materialize ×1

spring ×1

spring-boot ×1

yaml ×1