The benefit of jndi

  Spring applications will often be deployed to run within a Java EE application server such as WebSphere, JBoss, or even a web container like Tomcat. These servers allow you to configure data sources to be retrieved via JNDI.
     The benefit of configuring data sources in this way is that they can be managed completely external to the application,allowing the application to ask for a data source when it’s ready to access the database.Moreover, data sources managed in an application server are often pooled for greater performance and can be hot-swapped by system administrators

--------from spring in action 3

[size=xx-small] spring 应用程序经常是部署在websphere,jboss,或者tomcat应用服务器中,这些应用服务器可以通过查找JNDI来配置数据源。
这样配置数据源的好处就是可以让数据源与应用程序分离,当应用程序访问数据源的时候它已经准备好了,数据源配置在应用服务器可以采用连接池的方式以提供更好的性能,并且可以在应用程序运行时进行切换。
[/size]

你可能感兴趣的:(spring,dataSource,JNDI)