MongoDb via jndi

前端 未结 5 1085
隐瞒了意图╮
隐瞒了意图╮ 2020-12-09 23:22

Do you know if it is possible to setup mongodb instance in spring like any other db via datasource from jndi?

Thx

5条回答
  •  有刺的猬
    2020-12-10 00:08

    Reusing Juan Melo's custom implementation of ObjectFactory interface (CustomMongoJNDIFactory), it can be also configured using jndi-lookup tag of Spring's jee namespace and corresponding Tomcat config in context.xml file, like this:

    spring-mongodb-persistence-context.xml:

    
    
        
    
        
    
    
    

    context.xml:

    
    

提交回复
热议问题