Is Spring mongoTemplate thread safe?

2019-05-21 12:52发布

I define this Bean:

<bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
    <constructor-arg name="mongoDbFactory" ref="mongoDbFactory" />
    <constructor-arg name="mongoConverter" ref="mongoConverter" />
</bean>  

and i instantiate a mongoOprations using this Bean, now i want To know Is Spring mongoTemplate thread safe?

1条回答
看我几分像从前
2楼-- · 2019-05-21 13:06

As per spring docs.

Once configured, MongoTemplate is thread-safe and can be reused across multiple instances.

For more details see section 5.4

查看更多
登录 后发表回答