> classes = Set.of(
// File IO APIs
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/aot/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/aot/package-info.java
new file mode 100644
index 0000000000..7b85fd64f2
--- /dev/null
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/aot/package-info.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2025 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Infrastructure implementations of Spring AOT concerns.
+ *
+ * @author Stefano Cordio
+ */
+@NullMarked
+package org.springframework.batch.infrastructure.aot;
+
+import org.jspecify.annotations.NullMarked;
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/package-info.java
index 043937c70d..00d1530afe 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/package-info.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/package-info.java
@@ -1,7 +1,21 @@
+/*
+ * Copyright 2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
/**
- *
* Infrastructure interfaces and primary dependencies for item concerns.
- *
*/
@NullMarked
package org.springframework.batch.infrastructure.item;
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/queue/BlockingQueueItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/queue/BlockingQueueItemReader.java
index ae4f1b9588..c6ffac181e 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/queue/BlockingQueueItemReader.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/queue/BlockingQueueItemReader.java
@@ -20,7 +20,6 @@
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
-import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;
/**
@@ -32,7 +31,7 @@
* @author Mahmoud Ben Hassine
* @since 5.2.0
*/
-public class BlockingQueueItemReader implements ItemReader<@NonNull T> {
+public class BlockingQueueItemReader implements ItemReader {
private final BlockingQueue queue;
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/queue/BlockingQueueItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/queue/BlockingQueueItemWriter.java
index 4ede1a9be1..13a2fc6c46 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/queue/BlockingQueueItemWriter.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/queue/BlockingQueueItemWriter.java
@@ -20,8 +20,6 @@
import java.util.concurrent.BlockingQueue;
-import org.jspecify.annotations.NonNull;
-
/**
* This is an {@link ItemWriter} that writes items to a {@link BlockingQueue}.
*
@@ -29,7 +27,7 @@
* @since 5.2.0
* @author Mahmoud Ben Hassine
*/
-public class BlockingQueueItemWriter implements ItemWriter<@NonNull T> {
+public class BlockingQueueItemWriter implements ItemWriter {
private final BlockingQueue queue;
@@ -42,7 +40,7 @@ public BlockingQueueItemWriter(BlockingQueue queue) {
}
@Override
- public void write(Chunk extends @NonNull T> items) throws Exception {
+ public void write(Chunk extends T> items) throws Exception {
for (T item : items) {
this.queue.put(item);
}
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/queue/builder/BlockingQueueItemReaderBuilder.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/queue/builder/BlockingQueueItemReaderBuilder.java
index fbe1fe07da..a4beb64d2d 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/queue/builder/BlockingQueueItemReaderBuilder.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/queue/builder/BlockingQueueItemReaderBuilder.java
@@ -18,6 +18,7 @@
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
+import org.jspecify.annotations.Nullable;
import org.springframework.batch.infrastructure.item.queue.BlockingQueueItemReader;
import org.springframework.util.Assert;
@@ -30,7 +31,7 @@
*/
public class BlockingQueueItemReaderBuilder {
- private BlockingQueue queue;
+ private @Nullable BlockingQueue queue;
private long timeout = 1L;
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/queue/builder/BlockingQueueItemWriterBuilder.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/queue/builder/BlockingQueueItemWriterBuilder.java
index 40701e8fca..8284ad6b6d 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/queue/builder/BlockingQueueItemWriterBuilder.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/queue/builder/BlockingQueueItemWriterBuilder.java
@@ -17,6 +17,7 @@
import java.util.concurrent.BlockingQueue;
+import org.jspecify.annotations.Nullable;
import org.springframework.batch.infrastructure.item.queue.BlockingQueueItemWriter;
import org.springframework.util.Assert;
@@ -29,7 +30,7 @@
*/
public class BlockingQueueItemWriterBuilder {
- private BlockingQueue queue;
+ private @Nullable BlockingQueue queue;
/**
* Create a new {@link BlockingQueueItemWriterBuilder}
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/queue/builder/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/queue/builder/package-info.java
new file mode 100644
index 0000000000..5504f203c4
--- /dev/null
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/queue/builder/package-info.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2025 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Builders for Apache Kafka item reader and writer.
+ *
+ * @author Stefano Cordio
+ */
+@NullMarked
+package org.springframework.batch.infrastructure.item.queue.builder;
+
+import org.jspecify.annotations.NullMarked;
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/queue/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/queue/package-info.java
new file mode 100644
index 0000000000..3c1e91e048
--- /dev/null
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/queue/package-info.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2025 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * {@link java.util.concurrent.BlockingQueue} related readers and writers.
+ *
+ * @author Stefano Cordio
+ */
+@NullMarked
+package org.springframework.batch.infrastructure.item.queue;
+
+import org.jspecify.annotations.NullMarked;
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/redis/builder/RedisItemReaderBuilder.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/redis/builder/RedisItemReaderBuilder.java
index 1ee9d6efe9..a8a10173ee 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/redis/builder/RedisItemReaderBuilder.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/redis/builder/RedisItemReaderBuilder.java
@@ -15,9 +15,11 @@
*/
package org.springframework.batch.infrastructure.item.redis.builder;
+import org.jspecify.annotations.Nullable;
import org.springframework.batch.infrastructure.item.redis.RedisItemReader;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ScanOptions;
+import org.springframework.util.Assert;
/**
* Builder for {@link RedisItemReader}.
@@ -29,9 +31,9 @@
*/
public class RedisItemReaderBuilder {
- private RedisTemplate redisTemplate;
+ private @Nullable RedisTemplate redisTemplate;
- private ScanOptions scanOptions;
+ private @Nullable ScanOptions scanOptions;
/**
* Set the {@link RedisTemplate} to use in the reader.
@@ -58,6 +60,8 @@ public RedisItemReaderBuilder scanOptions(ScanOptions scanOptions) {
* @return a new item reader
*/
public RedisItemReader build() {
+ Assert.notNull(redisTemplate, "redisTemplate must not be null");
+ Assert.notNull(scanOptions, "scanOptions must no be null");
return new RedisItemReader<>(this.redisTemplate, this.scanOptions);
}
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/redis/builder/RedisItemWriterBuilder.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/redis/builder/RedisItemWriterBuilder.java
index 5e0eb3aac7..9c5db2b7c0 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/redis/builder/RedisItemWriterBuilder.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/redis/builder/RedisItemWriterBuilder.java
@@ -15,8 +15,7 @@
*/
package org.springframework.batch.infrastructure.item.redis.builder;
-import org.jspecify.annotations.NonNull;
-
+import org.jspecify.annotations.Nullable;
import org.springframework.batch.infrastructure.item.redis.RedisItemWriter;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.redis.core.RedisTemplate;
@@ -30,9 +29,9 @@
*/
public class RedisItemWriterBuilder {
- private RedisTemplate redisTemplate;
+ private @Nullable RedisTemplate redisTemplate;
- private Converter<@NonNull V, @NonNull K> itemKeyMapper;
+ private @Nullable Converter itemKeyMapper;
private boolean delete;
@@ -53,7 +52,7 @@ public RedisItemWriterBuilder redisTemplate(RedisTemplate redisTempl
* @return The current instance of the builder.
* @see RedisItemWriter#setItemKeyMapper(Converter)
*/
- public RedisItemWriterBuilder itemKeyMapper(Converter<@NonNull V, @NonNull K> itemKeyMapper) {
+ public RedisItemWriterBuilder itemKeyMapper(Converter itemKeyMapper) {
this.itemKeyMapper = itemKeyMapper;
return this;
}
@@ -73,11 +72,11 @@ public RedisItemWriterBuilder delete(boolean delete) {
* Validates and builds a {@link RedisItemWriter}.
* @return a {@link RedisItemWriter}
*/
- public RedisItemWriter<@NonNull K, @NonNull V> build() {
+ public RedisItemWriter build() {
Assert.notNull(this.redisTemplate, "RedisTemplate is required.");
Assert.notNull(this.itemKeyMapper, "itemKeyMapper is required.");
- RedisItemWriter<@NonNull K, @NonNull V> writer = new RedisItemWriter<>(this.itemKeyMapper, this.redisTemplate);
+ RedisItemWriter writer = new RedisItemWriter<>(this.itemKeyMapper, this.redisTemplate);
writer.setDelete(this.delete);
return writer;
}
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/redis/builder/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/redis/builder/package-info.java
new file mode 100644
index 0000000000..4ce00ad2f5
--- /dev/null
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/infrastructure/item/redis/builder/package-info.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2025 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Builders for Redis item reader and writer.
+ *
+ * @author Stefano Cordio
+ */
+@NullMarked
+package org.springframework.batch.infrastructure.item.redis.builder;
+
+import org.jspecify.annotations.NullMarked;