Why use JNDI for data sources

后端 未结 5 658
谎友^
谎友^ 2020-12-04 14:29

Can anyone help explain why JNDI should be a preferred way to expose services such as a database / jms?

The posts I run into all talk about the advantage of not havi

5条回答
  •  暖寄归人
    2020-12-04 14:58

    I think the "preferred" mechanism is the one that's preferred by the person doing the admin and configuration. As duffymo pointed out, it's crucial that the configuration be external to your deployable artifact, but otherwise, I'd say anything goes. If your sysadmin prefers using a GUI to configure JDNI entries, cool. If he/she prefers editing properties files with cssh and vi, cool too. If you're responsible for both developing and configuring/deploying your app, then that's pretty much your call. Personally, I like to keep as much implementation as possible inside my artifact, meaning that my data source and drivers live there, too.

    If you're asking about technical benefits of JNDI over the alternatives, I'm not sure there are any, but you might want to clarify your question.

提交回复
热议问题