how to put(bind) object to jndi in spring declaratively?

后端 未结 5 1706
抹茶落季
抹茶落季 2020-12-06 06:46

We have a plain standalone spring application and we need to put jdbc datasource in jndi. (we use jboss treecache and it need datasource to be in the jndi).

Some go

5条回答
  •  半阙折子戏
    2020-12-06 07:25

    I realize this is an old question, but there's a way to do this without custom code. It's fairly verbose, but 100% declarative.

    
    
    
    
    
    
    
        
        
        
            
                java:comp/UserTransaction
                
            
        
    
    
    
    
        
        
        
            
                another/jndi/name
                literal_value
            
        
    
    

    The MethodInvokingFactoryBean can also be used to set System properties (which comes in handy when using Atomikos), as long as the bean that reads the System properties depends-on that MethodInvokingFactoryBean.

    
        
            
        
        
        
    
    
        
            
                true
                true
                com.atomikos.icatch.standalone.UserTransactionServiceFactory
                /opt/txlogs
            
        
    
    
    

提交回复
热议问题