Hi,
i got stuck in the Eclipse 4 RCP - Tutorial at:
14. Dependency Injection and Annotations
14.1. What is Dependency Injection?
There is a nice example how to inject a Logger or something else.
// @Inject private Logger logger;
// // DatabaseAccessClass would talk to the DB
// @Inject private DatabaseAccessClass dao;
The one thing i don't get is where to register my classes i want to inject. Just creating a class and add the @Inject statement to another class seems not to be enough.
How to register my class so the applicationcontext is able to inject it?
I created a sample application. I created a class A with a function sayHello() :). What to do to be able to inject it to one of my handlers?
Thanks in advance :)
--
You received this message because you are subscribed to the Google Groups "vogella" group.
To view this discussion on the web visit https://groups.google.com/d/msg/vogella/-/-2vtyR5DRmUJ.
To post to this group, send email to vog...@googlegroups.com.
To unsubscribe from this group, send email to vogella+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/vogella?hl=en.
Hi,
I have a similar problem.
I have created my own service as plugin to use him in my application with dependency injection. This works fine inside classes like handlers.
But if I inject my service in any usual class (which is responsible for logic or sth. else) it does not work. The injected service is everytime null.
I also tried to inject some of the standard service like logger and eventbroker. I have determined the same behavior. It works in handler but not in my own classes.
Do I have to consider something else?
Thanks a lot.
To view this discussion on the web visit https://groups.google.com/d/msg/vogella/-/wgZ0SJpGh0oJ.
Hi,
thank you, i'll try, but it feels a little over sized to create and install an additional service just to install a single handler? Or am i missing something?
Thanks, Dennis
To unsubscribe from this group and stop receiving emails from it, send an email to vogella+u...@googlegroups.com.
To post to this group, send email to vog...@googlegroups.com.
Visit this group at http://groups.google.com/group/vogella?hl=en.For more options, visit https://groups.google.com/groups/opt_out.