开发者

Java REST using DataSource

I'm new to REST on Java and I would like to create "simple" REST services that queries a database and returns开发者_运维问答 some JSON info.

What I would like is to use JDBC access to DB, no JPA.

When working with servlets I configure a server datasource and in my servlets in the "init()" method I store a reference to the datasource and on every request create a connection.

What must I do for REST services?

Thanks in advance.


If you are planning to connect via JDBC based on the REST API requests and already familiar with REST, you should consider looking into Spring JDBC support: Current JDBC Spring Support. This would take care of all your concerns regarding the right place and time of instantiating/looking up a data source or connection.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜