You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Charlie Hubbard <ch...@gmail.com> on 2011/08/19 18:49:07 UTC

Defining custom Mailets using Spring injection in James 3.0?

Is there a way to injection spring beans into Mailets?  The
mailetcontainer.xml file isn't a spring file so does this mean you can't do
this?

I have an application that is based on spring already, and I'd like to pull
all of James under the same container, and create a custom mailet that I can
inject portions of this existing application into.

Thanks,
Charlie

Re: Defining custom Mailets using Spring injection in James 3.0?

Posted by Eric Charles <er...@apache.org>.
Hi Charlie,
Sure, simply define a class field annotated with @Resource (spring 
container will inject).

@Resource(name = "your-bean")
YourBean yourBean

See example in 
http://svn.apache.org/repos/asf/james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/SieveMailet.java

Thx.

On 19/08/11 18:49, Charlie Hubbard wrote:
> Is there a way to injection spring beans into Mailets?  The
> mailetcontainer.xml file isn't a spring file so does this mean you can't do
> this?
>
> I have an application that is based on spring already, and I'd like to pull
> all of James under the same container, and create a custom mailet that I can
> inject portions of this existing application into.
>
> Thanks,
> Charlie
>

-- 
Eric
http://about.echarles.net

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org