So, a lot of it really depends on the specifics of your app, the way you think of using guice, etc. Typically if the app is using guice then everyone is using guice. But you can have little graphs in subsets of the application, that are wired up by Guice, but not managed after that. In that situation you could use Guice and not force your co-workers to use it (though, if you use AOP, then your objects will be wrapped by cglib's Guice's generated byte code, and if you pass your objects to other developers' parts of the code, and they try to debug that, they will see these wrappers.)

Ultimately, you can't use Guice's AOP itself without Guice, inasmuch as Guice only applies AOP to objects it manages - but as Sam said, you can copy the approach. But for my money, if you want AOP and you don't want dependency injection, just use a straight AOP framework like AspectJ, or AspectWerkz or other frameworks at this site: http://java-source.net/open-source/aspect-oriented-frameworks

Christian.



On 9 Dec 2013, at 11:53, Lorenzo Bugiani wrote:

The problem is not Guice...
The problem is "use Guice without force my coworkers to use it", I don't
know if I'm clear...
I mean, if I start using Guice for AOP, all my application need to use
Guice? All my Object have to be injected by Guice or can I simply use Guice for my interceptor and leave my colleagues construct their objects normally?

For example, suppose you have to implement this functionality in your
application:
"Every time something is written to the database, log that operation".
This could be a typical case of the use of AOP: my coworkers don't have to know that they have to log everything when something is written to the DB. They simply have to write their application as usually, and the application
have to take care of this aspect...

Is it a possible scenario or not? There's some kind of sense in my example
or I'm wrong because I have to use Guice entirely or don't use it?
This is what I don't know...


2013/12/9 Sam Berlin <[email protected]>

Guice implements AOP using cglib (which uses ASM). You can do the same thing if that's all you want. However, without Guice you'll have a hard
time enforcing people are constructing the right instances.

sam


On Mon, Dec 9, 2013 at 2:16 PM, Lorenzo Bugiani <[email protected]>wrote:

Hi all,

there's a way to use AOP only feature of GUICE? And, in your opinion,
could have sense use AOP only?

I mean, in the company where I work we don't use any kind of DI
frameworks, and I know that starting using GUICE means that we have to change the way we think to an application, so is not so simple to introduce
a big change in a medium team of developer..
But I would like to implement some feature in our applications using AOP, because I think these features could be very usefull for everyone. I'd like
to implement feature that are transparent to the other people, so
Interceptors in my case I think are the best way to do this, without
changing how my coworkers have to work...

So, someone have any suggestion?
Is this the right way or not?
Thanks to all.

--
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice.
For more options, visit https://groups.google.com/groups/opt_out.


--
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice.
For more options, visit https://groups.google.com/groups/opt_out.


--
You received this message because you are subscribed to the Google Groups "google-guice" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice.
For more options, visit https://groups.google.com/groups/opt_out.


Christian Gruber :: Google, Inc. :: Java Core Libraries :: Dependency Injection
email: [email protected] :::: mobile: +1 (646) 807-9839

--
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to