Repeated meta-data items
B.2 Generating your own meta-data using the annotation processor
You can easily generate your own configuration meta-data file from items annotated with @ConfigurationProperties
by using thespring-boot-configuration-processor
jar. The jar includes a Java annotation processor which is invoked as your project is compiled. To use the processor, simply include spring-boot-configuration-processor
as an optional dependency, for example with Maven you would add:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
With Gradle, you can use the propdeps-plugin and specify:
dependencies {
optional "org.springframework.boot:spring-boot-configuration-processor"
} compileJava.dependsOn(processResources)
}
You need to add |
The processor will pickup both classes and methods that are annotated with @ConfigurationProperties
. The Javadoc for field values within configuration classes will be used to populate the description
attribute.
You should only use simple text with |
Properties are discovered via the presence of standard getters and setters with special handling for collection types (that will be detected even if only a getter is present). The annotation processor also supports the use of the @Data
, @Getter
and @Setter
lombok annotations.
B.2.1 Nested properties
The annotation processor will automatically consider inner classes as nested properties. For example, the following class:
@ConfigurationProperties(prefix="server")
public class ServerProperties { private String name; private Host host; // ... getter and setters private static class Host { private String ip; private int port; // ... getter and setters } }
Will produce meta-data information for server.name
, server.host.ip
and server.host.port
properties. You can use the @NestedConfigurationProperty
annotation on a field to indicate that a regular (non-inner) class should be treated as if it were nested.
B.2.2 Adding additional meta-data
Spring Boot’s configuration file handling is quite flexible; and it often the case that properties may exist that are not bound to a @ConfigurationProperties
bean. To support such cases, the annotation processor will automatically merge items from META-INF/additional-spring-configuration-metadata.json
into the main meta-data file.
The format of the additional-spring-configuration-metadata.json
file is exactly the same as the regular spring-configuration-metadata.json
. The additional properties file is optional, if you don’t have any additional properties, simply don’t add it.
http://docs.spring.io/spring-boot/docs/1.3.0.M1/reference/html/configuration-metadata.html#configuration-metadata-annotation-processor
Repeated meta-data items的更多相关文章
- Android 访问Android Wear数据层Api——同步Data Items
Data Items它被用来同步手机和wear数据接口,一个Date Items通常包含以下几个部分: Payload 字节数组.无论你需要设置数据类型,我们同意对象序列化和反序列化,大小不能超过10 ...
- 【记】研究Sharding-JDBC遇到的一个异常(Caused by: io.shardingsphere.core.exception.ShardingException: Cannot get uniformed table structure for `t`. The different meta data of actual tables are as follows)
一.异常信息 Caused by: io.shardingsphere.core.exception.ShardingException: Cannot get uniformed table str ...
- A JavaScript library for reading EXIF meta data from image files.
exif-js/exif-js: JavaScript library for reading EXIF image metadata https://github.com/exif-js/exif- ...
- 《BI那点儿事》META DATA(元数据)
关于数据仓库的数据,指在数据仓库建设过程中所产生的有关数据源定义,目标定义,转换规则等相关的关键数据.同时元数据还包含关于数据含义的商业信息,所有这些信息都应当妥善保存,并很好地管理.为数据仓库的发展 ...
- Facebook图片存储系统Haystack——存小文件,本质上是将多个小文件合并为一个大文件来降低io次数,meta data里存偏移量
转自:http://yanyiwu.com/work/2015/01/04/Haystack.html 一篇14页的论文Facebook-Haystack, 看完之后我的印象里就四句话: 因为[传统文 ...
- OpenStack Swift集群部署流程与简单使用
之前介绍了<OpenStack Swift All In One安装部署流程与简单使用>,那么接下来就说一说Swift集群部署吧. 1. 简介 本文档详细描述了使用两台PC部署一个小型Sw ...
- OpenTSDB-Writing Data
Writing Data You may want to jump right in and start throwing data into your TSD, but to really take ...
- Data Management Technology(1) -- Introduction
1.Database concepts (1)Data & Information Information Is any kind of event that affects the stat ...
- QAbstractTableModel中的data()到底执行几遍???
发现问题的过程 1.一个普通的继承 QAbstractTableModel 的类 class CurrencyModel : public QAbstractTableModel { public: ...
- [论文笔记] Methodologies for Data Quality Assessment and Improvement (ACM Comput.Surv, 2009) (1)
Carlo Batini, Cinzia Cappiello, Chiara Francalanci, and Andrea Maurino. 2009. Methodologies for data ...
随机推荐
- iOS开发之OC篇-响应式编程Reactive Cocoa
一.Reactive Cocoa 介绍 Reactive Cocoa 是 iOS 开发的一个 "重量级" 框架 高大上的概念:响应式编程 核心概念:信号 Signal 官方网站:h ...
- debian gnome 3插件
1.gnome 配置-安装插件 http://maxubuntu.blogspot.com/2012/09/debian-gnome3.html hunagqf|hunaqf2|hunaqf3 2.快 ...
- 在线程中建立Form遇到的问题
一个项目由很多Form组成,默认情况下在启动程序时,这些form都会被建立,这会黑屏很长时间,一种方法是用到Form时再建立,结果又发现如果Form设计复杂,建立的过程也会超过1秒以上,于是想到用线程 ...
- javascript之Arguments
一.Arguments.callee //获取当前正在执行的函数,也就是这个函数自身,常用于获取匿名函数自身 语法:arguments.callee var factorial = function ...
- Java Keyword -- super
Reference: super When we override superclass's methods, but still want to invoke them, we can use ke ...
- JSONObject和JSONArray的简单使用(json-lib)
一. jar包 commons-lang.jar commons-beanutils.jar commons-collections.jar commons-logging.jar ezmorph.j ...
- 精讲N皇后问题
思想:存三个数组记录记录走的过程,运用回溯不符合或row==n+1就跳出当前层,直到找完:递归时的路径都在保存着,当连续跳出到第一次进入的dfs且i=n时就全部跳出dfs函数了: # ...
- AutoResetEvent与ManualResetEvent区别
本文来自:http://www.360doc.com/content/10/1126/10/3267996_72536817.shtml 在.Net多线程编程中,AutoResetEvent和Manu ...
- 工作记录8:iOS 传值问题总结(7种传值完美介绍)
1.属性传值 前向后传值. 记住: /* 1: 属性传值第一步需要用到什么类型就定义什么样的属性 2: 从上一个页面到一个页面的选中方法里面将要传的值传到来(上一个页面)备注:这种方法只适用于上一个页 ...
- 简单随笔——如何在gridview的页脚显示信息。。。。
我是超级大菜鸟...哈哈 先上图看看是不是你需要的 第一步,右击gridview,在事件中,单击RowdataBond事件. 在这之前一定要记得在gridview属性中的ShowFooter设置为“t ...