You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by David Blevins <da...@visi.com> on 2007/01/03 21:36:58 UTC
Configuring a resource (Re: Bean lookup failure if interface annotation used on bean class)
On Jan 3, 2007, at 2:53 AM, Raj Saini wrote:
> Hi David,
>
>> David Blevins wrote:
>>>
>>> On Dec 27, 2006, at 8:09 PM, Raj Saini wrote:
>>>
>>>
>>> The related functionality for those isn't implemented (should be
>>> soon). In the mean-time would you be interested in doing one of
>>> these?
>>>
>>> [OPENEJB-355] Example: @Resource for Field Injection
>>> [OPENEJB-356] Example: @Resource for Setter Injection
> How do I configure a resource (e.g. a data source or a mail) into
> OpenEJB3? In other Java EE servers, resources are configured
> through server configuration files. I have no idea how to do it in
> OpenEJB.
For these examples I'd go with only env-entry items. The example for
using @Resource for JDBC lookup is a different example (OPENEJB-358).
But to answer the question, you can have an openejb.conf file in your
test case as well as an openejb-jar.xml file to link to the data
source configured in your openejb.conf. Similarly, we can also
create an openejb.conf and openejb-jar.xml for you dynamically and
give you the default data source if you need one. At the moment the
default is HSqlDB.
I'd like to provide a way to configure the datasource through
properties so in the most ideal scenario you'd only need one extra
property in your InitialContext creation code to get a datasource
configured and available to your bean.
There was some discussion on this a long while back:
http://www.mail-archive.com/dev@openejb.org/msg00171.html
Good read.
-David