incubator-isis-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Haywood <...@haywood-associates.co.uk>
Subject Re: isis service inject in version 0.3.1 snapshot
Date Fri, 12 Oct 2012 08:32:19 GMT
On 12 October 2012 09:04, 张峰昌 <alain.zhang@gmail.com> wrote:

> Dear All
>
> Hi Alain, and welcome.

This question might be best directled to isis-users, so I've cc'ed this
reply  there.

fyi, I suggest that you subscribe to that list (mailto:
isis-users-subscribe@incubator.apache.org).  But by all means subscribe to
this list too (mailto:isis-dev-subscribe@incubator.apache.org) if you are
interested in contributing to Isis in the future.




> Can anyone tell me how to inject service into another one? For example I
> want to inject OrgnizationRepository into ProductRepositoryInMemory.
>
> I have follewd the instruction according to the doc online which said about
> inject service into domain object by provided the  public setXXX, while it
> can not work when I inject inject OrgnizationRepository into
> ProductRepositoryInMemory. The exception is:
>
> org.apache.isis.core.metamodel.spec.ObjectSpecificationException: Service
> object com.thingray.product.dom.ProductRegisterService should have no
> fields, but has: organizationRepository, productRepository
>
>
The short answer is: you do need a setter, but must have no public getter
for that injected service.  The fix is simply either to remove that getter,
or to mark it as protected, package or private visibility.

If that doesn't fix things (or you don't have a public getter but even so
are still having the exception), then let us know.

Thx
Dan

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message