Spring JDBC-如何为Web服务注入DataSource? [英] Spring JDBC - how to inject DataSource for web services?

查看:131
本文介绍了Spring JDBC-如何为Web服务注入DataSource?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个仅公开Web服务的Web应用程序. Web服务只是用于对数据库进行存储过程调用的简单桥梁.

当前,我计划使用Spring JDBC,但是如果没有在实例化它的主函数,该如何注入数据源?

我的猜测是答案是在某些web.xml配置或applicationContext.xml本身中...

我一直在尝试为此在网上找到一个帖子,但是到目前为止还没有运气.很多好的信息,但不完全是我要拍摄的信息.

谁能发光?

感谢

I have a web application which only exposes web services. The web services are just a simple bridge for making stored procedure calls to the database.

Currently I plan using Spring JDBC, but how do I inject the DataSource if I have no main function where instantiate it?

My guess is the answer is in some web.xml configuration or applicationContext.xml itself...

I been trying to find a post on the web for this, but no luck so far. Lots of good info, but not exactly what I am shooting for.

Can anyone shine?

thanks

推荐答案

您可以使用Spring AOP模块,可以在程序中的任何位置插入代码.

像:
a)在b)之后在c)之前
根据您的要求在代码内


检查此链接

http://static.springsource.org/spring/docs/1.2.x/reference/aop.html [^ ]

http://www.javabeat.net/articles/51- Introduction-to-springs-aspect-oriented-programminga-1.html [
You can use Spring AOP module, you can inject your piece of code any where in the program.

like :
a) After b) before c) around
inside your code as per your requirement


check this links

http://static.springsource.org/spring/docs/1.2.x/reference/aop.html[^]

http://www.javabeat.net/articles/51-introduction-to-springs-aspect-oriented-programminga-1.html[^]


这篇关于Spring JDBC-如何为Web服务注入DataSource?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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