'init' method of a Mailet is called only ONCE during the Mailet's lifecycle,
so this is ok.

On Wed, Mar 18, 2009 at 1:51 AM, Corrado Alesso <[email protected]>wrote:

> In data 18 marzo 2009 alle ore 06:43:37, Bernd Fondermann <
> [email protected]> ha scritto:
>
>  You could create a singleton object within the Spring App Context
>> which is also available through a public static getter
>> "getInstance()". Then, at Mailet creation, you access all spring
>> context objects through this singleton. Make the singleton implement
>> ApplicationContextAware.
>>
>> The best way depends on how you set up your James Server / Spring App.
>> Can you tell more about how you intend to let both run in the same VM?
>>
>>  Bernd
>>
>
> Thank you all. This is my first encounter with James/Mailets so I just need
> to get the big picture.
>
> Here I explain what I would like to create.
>
> I have a web application that heavily rely on Spring. That's ok since I
> decided from the very beginning to fully take advantage of the Spring stack.
> So now I have a lot of DAOs and beans that use Spring AOP, Transactions and
> other nice things. All these beans are declared into an
> ApplicationContext.xml and one of these DAOs is needed by the Mailet. The
> purpose of the Mailet will be to save into a Postgres DB mail's metadata and
> attachments after some processing. As I said, I already have the DAO and the
> logic written for this purpose (processing and db access), I just need the
> Mailet to "get" the DAO and the beans and trigger the action.
>
> I did a quick experiment initializing the ApplicationContext in the
> Mailet's init() method and I managed to get it work. I'm now looking for
> informations about a Mailet's lifecycle, because I saved the AppContext
> object reference in a static field so that multiple invocation of the init
> method won't cause a new AppContext to be instantiated.
>
> Is this ok?
>
> Thank you very much,
> Corrado
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to