Skip to content

Commit cae2cab

Browse files
ninja-incmminella
authored andcommitted
BATCH-2567: Allow to access MongoItemWriter.template from a subclass
JIRA: https://jira.spring.io/browse/BATCH-2567
1 parent b2f91ae commit cae2cab

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/MongoItemWriter.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012 the original author or authors.
2+
* Copyright 2012-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -76,6 +76,16 @@ public void setTemplate(MongoOperations template) {
7676
this.template = template;
7777
}
7878

79+
/**
80+
* Get the {@link MongoOperations} to be used to save items to be written.
81+
* This can be called by a subclass if necessary.
82+
*
83+
* @return template the template implementation to be used.
84+
*/
85+
protected MongoOperations getTemplate() {
86+
return template;
87+
}
88+
7989
/**
8090
* Set the name of the Mongo collection to be written to.
8191
*

0 commit comments

Comments
 (0)