使用JBoss 7 JNDI和Spring创建数据源 [英] Create DataSource using JBoss 7 JNDI and Spring

查看:138
本文介绍了使用JBoss 7 JNDI和Spring创建数据源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是第一次为Jboss服务器制作一个Webapp。
对于JBoss,我们有jndi的详细信息,但是我想知道如何在春季应用程序上下文中使用它来创建数据源。

I am first time making a webapp for Jboss server. For JBoss we have the jndi details, but I am wondering how to create the Datasource using it in spring application context.

如果有人要创建示例,连接,请共享它。

If anyone has an example to create the connection, please share it.

推荐答案

我找到了解决方案

将以下配置添加到applicationContext.xml

Add below configuration to applicationContext.xml

xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="http://www.springframework.org/schema/jee
        http://www.springframework.org/schema/jee/spring-jee-3.0.xsd"

<jee:jndi-lookup expected-type="javax.sql.DataSource" id="dataSource" jndi-name="java:jboss/SAMPLE_JNDI"/>

这篇关于使用JBoss 7 JNDI和Spring创建数据源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆