From e4a7bd84dffb10f13853bf402fa0739e2ec9777e Mon Sep 17 00:00:00 2001 From: Mahmoud Ben Hassine Date: Wed, 23 Oct 2024 05:57:09 +0200 Subject: [PATCH] Clarify the behaviour of MultiResourceItemWriter with regard to file creation Resolves #4645 --- .../batch/item/file/MultiResourceItemWriter.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/MultiResourceItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/MultiResourceItemWriter.java index 1480cba407..835abb3527 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/MultiResourceItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/MultiResourceItemWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2023 the original author or authors. + * Copyright 2006-2024 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. @@ -36,7 +36,11 @@ *

* Note that new resources are created only at chunk boundaries i.e. the number of items * written into one resource is between the limit set by - * {@link #setItemCountLimitPerResource(int)} and (limit + chunk size). + *

+ * This writer will create an output file only when there are items to write, which means + * there would be no empty file created if no items are passed (for example when all items + * are filtered or skipped during the processing phase). + *

* * @param item type * @author Robert Kasanicky