Life cycle and scope of mybatis

Fairy-KunKun 2022-05-14 14:37:48 阅读数:951

lifecyclescopemybatis

Incorrect use mybatis, Can cause serious concurrency problems ( Thread unsafe ).

SqlSessionFactory Should be valid throughout the application , And just one

Best practices , use spring Dependency injection container implementation .

temporary : Implement... In static code blocks SqlSessionFactory The creation of --- For once , Will not recreate

      SqlSessionFactory Use static modification , Class properties , Exists in the method area

Yes SqlSessionFactory encapsulation

版权声明:本文为[Fairy-KunKun]所创,转载请带上原文链接,感谢。 https://javamana.com/2022/134/202205141429154062.html