From cae2cabdce41ae9a67d4e469fb8b82ff4945a7d9 Mon Sep 17 00:00:00 2001 From: Takaaki Iida Date: Mon, 9 Jan 2017 21:28:14 +0900 Subject: [PATCH] BATCH-2567: Allow to access MongoItemWriter.template from a subclass JIRA: https://jira.spring.io/browse/BATCH-2567 --- .../batch/item/data/MongoItemWriter.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/MongoItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/MongoItemWriter.java index 636ce5822..487070f8a 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/MongoItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/MongoItemWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 the original author or authors. + * Copyright 2012-2017 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. @@ -76,6 +76,16 @@ public class MongoItemWriter implements ItemWriter, InitializingBean { this.template = template; } + /** + * Get the {@link MongoOperations} to be used to save items to be written. + * This can be called by a subclass if necessary. + * + * @return template the template implementation to be used. + */ + protected MongoOperations getTemplate() { + return template; + } + /** * Set the name of the Mongo collection to be written to. *