Bernd Fondermann ha scritto: > Hi, > > Two Avalon lifecycle method calls on components are configure() and > initialize(), in that order. > > AbstractJamesService.configureHelloName() is called from the configure() > method and utilizes DNSServer component. > But unfortunately, DNSServer is not through initialize() itself yet, > where critical fields get set, so it raises a NPE in lookup().
Weird. If a component depends on another components then Phoenix give you a fully initialized service. So if a dnsserver is there (not null) then it should be fully initialized. AFAIK phoenix never bind uninitialized components (and that's also why it does not support cyclic dependencies at all). > In Phoenix based James it does not seem to be a problem (which I do not > understand), but in Spring currently it is. I've not looked at your code: how did you implement the lifecycle? Do you completely initialize dependencies before the service() call? IIRC this is the right order for initialization: enableLogging contextualize service parameterize configure initialize start So inside call you should have already received fully initialized dependencies. > configure() should only be used for reading configuration attributes, > not for doing anything more or even calling sibbling components. Not sure this is a requirement of the avalon contract at all. Btw configure and initialize are called one after the other, with no changes to the dependencies in the mean time. Btw if moving code from configure to intialize fix your issue, feel free to move that code. The point in doing things in configure instead of initialize is to be able to catch configurations errors before running through the initialization, otherwise everything can be delayed to initialization. > I will try now to split configureHelloName() into configureHelloName() + > initializeHelloName(). > > Does that sound reasonable? > > Bernd If this helps +1, but I think you should look for the problem in the spring-avalon wrapper as from my understanding there is no avalon contract that is fixed by the action you propose. Stefano --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
