我有一个REST服务,我想为我的客户开发团队记录.
所以我加了一些Links从Spring-Hateoas我的资源API,并插入到它swagger-springmvc @Api...注解来记录一切,使一个很好的API参考我的角团队能够理解我的REST服务.
问题是swagger无法发现可能的链接,只是给我一大堆Links而不说他们可能的价值观.
这是一个(简单)的例子.Swagger检测到:
Model Schema
CollectionListResource {
collections (array[CollectionResource]): All available collections,
links (array[Link]): Relations for next actions
}
CollectionResource {
collectionId (string): Collection Unique Id,
name (string): Human readable collection name,
links (array[Link]): Relations for next actions
}
Link {
rel (string, optional),
templated (boolean, optional),
href (string, optional)
}
Run Code Online (Sandbox Code Playgroud)
我实际上在HAL中:
{"collections":
[{"collectionId":"5370a206b399c65f05a7c59e",
"name":"default",
"_links":{ [
"self":{
"href":"http://localhost:9080/collections/5370a206b399c65f05a7c59e"
},
"delete":{
"href":"http://localhost:9080/collections/5370a206b399c65f05a7c59e"
}
]}
}, ...]}
Run Code Online (Sandbox Code Playgroud)
我试图扩展Link …
我使用Jacoco eclipse插件来测量单元测试覆盖率,并且我能够使用它导出报告.我想将该报告与声纳集成,因此我在项目属性文件中给出了它的路径.我的属性文件看起来像这样
# Required metadata
sonar.projectKey=key
sonar.projectName=name
sonar.projectVersion=1.0
sonar.jacoco.reportPath=jacoco.exec
sonar.tests=junit
sonar.dynamicAnalysis=reuseReports
sonar.java.coveragePlugin=jacoco
sonar.jacoco.reportMissing.force.zero=true
# Comma-separated paths to directories with sources (required)
sonar.sources=src
# Comma-separated paths to directories with tests (optional)
sonar.tests=test
# Encoding of the source files
sonar.sourceEncoding=UTF-8
# Language
sonar.language=java
Run Code Online (Sandbox Code Playgroud)
当我执行声纳运行器时,控制台输出中有以下行
16:23:13.219 INFO - Sensor JaCoCoItSensor...
16:23:13.219 INFO - No JaCoCo analysis of project coverage can be done since there is no class files.
16:23:13.219 INFO - Sensor JaCoCoItSensor done: 0 ms
16:23:13.219 INFO - Sensor JaCoCoOverallSensor...
16:23:13.219 INFO …Run Code Online (Sandbox Code Playgroud) 我正在开发一个smartcardio用于处理智能卡的Java应用程序.必须有一个可以移除其USB读卡器,然后再次插入它而无需再次启动小程序.
我正在使用terminals()和waitForChange()方法来检测终端更改,它在Linux,MacOS和Win7上运行良好.
但是在Windows 8(仅限Windows 8)上,删除最后一个终端后,这些方法抛出一个SCARD_E_NO_SERVICE CardException,并且不再检测到任何更改.
我不确定它所说的"服务"是什么.但是当我打电话TerminalFactory.getDefault()给一个TerminalFactory单身人士时,我认为这是在我的主题中启动的.而且我认为这个单例可能有办法管理底层服务,这就是被打破的.
有没有人smartcardio在Windows 8 上如何管理终端断开?
我需要将有关数据约束或默认值的信息提供给将使用API的客户端应用程序.生成的模式或ALPS Spring Data Rest似乎是放置此信息的好地方.
但是关于记录API的部分在官方参考文档中有点快,我在社区中找不到完整记录的示例.我试图阅读代码,PersistentEntityToJsonSchemaConverter以了解所提供的可能性,但头痛首先到达.
我知道@Description我可以在实体和属性上添加注释来更改title模式的字段.我知道可以修改相同的字段rest-messages.properties
是否有其他字段可以通过注释或配置文件进行修改?在此描述字段中放置默认或约束信息真的感觉就像不直接使用它.
考虑到Spring Boot CommandLineRunner应用程序,我想知道如何过滤传递给Spring Boot的"switch"选项作为外部化配置.
例如,用:
@Component
public class FileProcessingCommandLine implements CommandLineRunner {
@Override
public void run(String... strings) throws Exception {
for (String filename: strings) {
File file = new File(filename);
service.doSomething(file);
}
}
}
Run Code Online (Sandbox Code Playgroud)
我可以打电话java -jar myJar.jar /tmp/file1 /tmp/file2,两个文件都会调用该服务.
但是如果我添加一个Spring参数,java -jar myJar.jar /tmp/file1 /tmp/file2 --spring.config.name=myproject那么配置名称就会更新(正确!),但是服务也会被调用./--spring.config.name=myproject,当然这个文件不存在.
我知道我可以手动过滤文件名,例如
if (!filename.startsWith("--")) ...
Run Code Online (Sandbox Code Playgroud)
但由于所有这些组件都来自Spring,我想知道是否有一个选项可以让它管理它,并确保strings传递给run方法的参数不会包含已在应用程序级别解析的所有属性选项.
我使用Spring Data Rest覆盖JPA映射.
JPA为@PrePersist在DB中实体的持久性之前调用的方法提供注释.
Spring Data Rest为@HandleBeforeCreate捕获实体创建事件时要调用的方法提供注释.
这似乎与我相当.我何时应该使用另一个?何时应该使用另一个?
我刚刚安装了Firefox Dev Edition,但我不知道如何browsersync在启动它时启动它。
我知道有一个browser选项可以指定“firefox”,但如何区分一个 FF 安装与另一个安装?
如果我安装了各种常规 FF(例如 3.5、48.x 和 50.x),问题也会相同。
我总是可以手动打开正确的 FF 并在 browsersync 启动后加载页面,但我希望它手动执行此操作(并且不要在我的常规非开发 FF 中打开)。
java ×4
spring ×2
browser-sync ×1
command-line ×1
firefox ×1
gulp ×1
jacoco ×1
jpa ×1
jsonschema ×1
pcsc ×1
rest ×1
smartcard ×1
sonar-runner ×1
sonarqube ×1
spring-batch ×1
spring-boot ×1
spring-data ×1
spring-mvc ×1
swagger ×1
windows-8 ×1