You still have to use @SpringBean with the injector. @SpringBean
tells the injector where to inject things.
On Thu, Nov 12, 2009 at 3:10 AM, Sam Barrow wrote:
> Oh okay. I've been trying to use @SpringBean which of course didn't work
> because EntityModel is not a component. Tha
Oh okay. I've been trying to use @SpringBean which of course didn't work
because EntityModel is not a component. Thanks alot!
On Thu, 2009-11-12 at 09:02 +0100, Matthias Keller wrote:
> Injection is easy
>
> Just call:
> InjectorHolder.getInjector().inject(this);
Injection is easy
Just call:
InjectorHolder.getInjector().inject(this);
in your EntityModel constructor.
That's it.
While developing if you hot-redeploy often, you might also want to do a
check in load() like:
if (this.whateverService == null)
InjectorHolder.getInjector().inject
the instance given the class and the id, for example:
> T entity = entityManager.find(entityClass, id);
>
> Matt
>
> Sam Barrow wrote:
> > We have close to a hundred repositories, this wouldn't work. How do you
> > inject the services into the EntityModel
s into the EntityModel anyway?
On Thu, 2009-11-12 at 08:34 +0100, Matthias Keller wrote:
Hi Sam
What exactly do you mean by repository? Do you have to load every entity
from another place?
in load(), we have the code to load every possible entity in our
implementation, for example:
T entity;
if (
We have close to a hundred repositories, this wouldn't work. How do you
inject the services into the EntityModel anyway?
On Thu, 2009-11-12 at 08:34 +0100, Matthias Keller wrote:
> Hi Sam
>
> What exactly do you mean by repository? Do you have to load every entity
> from an
== Company.class) {
entity = companyService.load(...);
} else .
And so on. In the end, the entity is loaded from wherever it is defined
for this class...
Matt
Sam Barrow wrote:
Does anybody how to pass a smart EntityModel (link below) to another
page? We use a different repository for
Does anybody how to pass a smart EntityModel (link below) to another
page? We use a different repository for each entity type. I can't get it
to work. I have tried storing the repository as a field on the
EntityModel and using an abstract method on EntityModel to retrieve it.