You seem to be asking for contradictory things: 1. I don't want MyPrivateService to be available in the Tapestry registry 2. I want MyPrivateService available in the Tapestry registry so that I can advise it
Perhaps a solution is to setup a second, private Tapestry IOC registry for defining your private services. Your public service then looks up the private service from the private registry instead of from the public registry. On Wednesday, 28 March 2012, fmaylinch <ferranmayli...@gmail.com> wrote: > > Kalle Korhonen-2 wrote >> >> Well, you have multiple instances of the object that you are using a >> "private service". If you needed to, the instances could use private >> static variables to hold the state. It's typically not a good idea to >> make a service stateful, but since you were asking about making a >> private service (i.e. a single instance), I assumed you specifically >> have a need for creating a singleton. >> > > Sorry, I still don't get you... Can you write an example? Some simple > pseudocode is fine. Thank you! > > We can't use the @Autobuild solution because we need to advise methods of > this "private" service, so I suppose we need to "publish" the service (via > "bind" or "build" method) so we can apply the advisor this way: > > @Match({"MyPrivateService"}) > public static void adviseTransactions(HibernateTransactionAdvisor advisor, > MethodAdviceReceiver receiver) > { > advisor.addTransactionCommitAdvice(receiver); > } > > I've been thinking about the whole idea of this "private" service and the > reason we need it is because some service A uses methods from service B but > no other page or service should use B directly; everyone else should perform > operations through A. But methods inside B can't be moved to A because B > methods must be advised. > > I think Tapestry could offer some solution to this situation, don't you > think? (It's a suggestion) > > Thank you all for your help! > > -- > View this message in context: http://tapestry.1045711.n5.nabble.com/How-to-define-a-private-service-a-service-only-for-another-service-tp5597443p5599854.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >