Spring Batch JSR-305 支持
honeymoose 发布时间:2019-01-22 10:56:32 浏览64 评论0摘要: 本发布版本中为 JSR-305 支持添加了一个注解。这个为了与 Spring 框架中的 Null-safety 注解取得平衡,然后为 Spring Batch 添加为 public APIs。 这个注解不仅仅在使用 Spring Batch APIs 来强制空安全(null-safety),同时还可以通过使用 IDEs 来提供有用的相关 nullability 信息。
本发布版本中为 JSR-305 支持添加了一个注解。这个为了与 Spring 框架中的 Null-safety 注解取得平衡,然后为 Spring Batch 添加为 public APIs。
这个注解不仅仅在使用 Spring Batch APIs 来强制空安全(null-safety),同时还可以通过使用 IDEs 来提供有用的相关 nullability 信息。例如,如果用户希望实现 ItemReader 接口,任何能够支持 JSR-305 注解的 IDE 将会生成类似下面的代码:
public class MyItemReader implements ItemReader<String> {
@Nullable
public String read() throws Exception {
return null;
}
}
@Nullable 注解将会出现在 read 方法中,用来表示这个方法的内容可能将会返回一个 null。
这个将会强制在 Javadoc 中强制表示当在数据资源耗尽的时候,方法 read 将会返回一个 null。
相关文章
- Spring 5.0.3.RELEASE中的 Kotl…
- Android Studio 解决 Conflict w…
- Spring Data(一)概念和仓库的定义
- Kotlin与Java互操作
- Spring Framework 5.0 RC2 发布
- java 代码混淆 proguard exception
- CoreException: Could not get…
- Spring Cloud ZooKeeper集成Feig…
- Spring Cloud ZooKeeper集成Feig…
- Spring Cloud ZooKeeper集成Feig…