Coder Social home page Coder Social logo

test_mongodb_session's Introduction

Test_Mongodb_Session

MongoDB测试多文档事务

  • 看了下官方文档,试了下根据官方文档的来发现行不通, 官方文档链接, 很奇怪,可能是springboot版本的问题,后来我重新创建了一个2.2.7版本的springboot跟着同版本的官方文档来还是会有错误。 官方文档是继承了一个抽象类,新增一个MongoTransactionManager的方法,还要重写其他的一些方法。但是我尝试了,一直报错,报错原因是创建bean失败。 官方文档的方式报错了,已经无语。 后面找到了一篇博客,直接往容器里加一个MongoTransactionManager就好了。 然后在需要事务的方法上加上@Transactional注解就能实现事务控制。

注意事项: 注意自己的springboot版本吧,然后还是要看着官方文档来,不同版本之间的还是有区别的。还有就是mongodb版本要升级到4.0以上, 且需要搭建一个复制集的环境,否则是无法实现事务控制的。

test_mongodb_session's People

Contributors

liukw avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.