@Provides

1 view
Skip to first unread message

cowwoc

unread,
Apr 6, 2010, 4:37:18 PM4/6/10
to ibaguice
Hi,

I'd like to provide a DataSource using the Guice 2.0 @Provides
annotation. Right now I'm forced to pass a Provider class into the
SqlSessionFactoryModule constructor. Here are two possibilities...

1. Using the default constructor should imply that the DataSource is
bound by another module, as opposed to assuming the use of
PooledDataSource.

2. Alternatively, use the Builder design pattern in place of
SqlSessionFactoryModule's constructor because you will probably need
to add more arguments in the future.

Gili

Simone Tripodi

unread,
Apr 7, 2010, 3:50:01 AM4/7/10
to ibag...@googlegroups.com
Hi Gili,
first of all very nice to meet you and welcome to our small group :)

Thanks a lot, very interesting hints, maybe the point nr. 2 could
really improve the APIs, let's think about it :)

We designed the DataSource injection in the way you found since we
thought adding support of 3rd parties DataSource as well (c3p0, apache
commons-dbcp), so users are free to inject their preferred DS library
without any restriction. BTW suggestions are always more than
welcome!!!

See you, have a nice day,
Simo

http://people.apache.org/~simonetripodi/

> --
> To unsubscribe, reply using "remove me" as the subject.
>

Reply all
Reply to author
Forward
0 new messages