Have you been able to reproduce an issue with the current setup in
2.0.2? If so, please describe the steps so we can verify it is a bug.

Thanks,

Matt

On Mon, Jan 4, 2010 at 10:25 AM, Марат Камалов <mkamalo...@gmail.com> wrote:
> Hi,
>
> I have found this bug in 1.8.2 and 2.0.2. I haven't seen the last version
> yet.
>
> We have the following bean with scope prototype
>
>     <bean id="mailMessage"
> class="org.springframework.mail.SimpleMailMessage"
>         scope="prototype">
>         <property name="from" value="${mail.default.from}" />
>     </bean>
>
> Then we inject this bean to every controller where we want to send some
> email message.
>
>     <bean id="userFormController"
> class="ru.icl.ios.mzioppd.webapp.controller.UserFormController">
>         <property name="validator" ref="beanValidator"/>
>         <property name="formView" value="userForm"/>
>         <property name="successView" value="redirect:users.html"/>
>         <property name="cancelView" value="redirect:mainMenu.html"/>
>         <property name="userManager" ref="userManager"/>
>         <property name="roleManager" ref="roleManager"/>
>         <property name="mailEngine" ref="mailEngine"/>
>         <property name="message" ref="mailMessage"/>
>         <property name="templateName" value="accountCreated.vm"/>
>     </bean>
> and
>     <bean id="passwordHintController"
> class="ru.icl.ios.mzioppd.webapp.controller.PasswordHintController">
>         <property name="userManager" ref="userManager"/>
>         <property name="messageSource" ref="messageSource"/>
>         <property name="mailEngine" ref="mailEngine"/>
>         <property name="message" ref="mailMessage"/>
>     </bean>
>
> So, the object mailMessage in the different controllers will be different
> too, becouse bean mailMessage has scope="prototype". But what about
> UserFormController in concurrent requests?? UserFormController is singleton,
> becouse singleton is default scope in spring with dtd 2.0. And a custom
> default scope isn't defined...
>
> <beans xmlns="http://www.springframework.org/schema/beans";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>        xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd";
>        default-lazy-init="true">
>
> Have we concurrent modification of mailMessage object???
>
> I think that we have. Probably, we should use the following code... Or use
> another approach(synhronize send method or create a new message every time
> in controller).
>
>     <bean id="mailMessage"
> class="org.springframework.mail.SimpleMailMessage"
>         scope="request">
>         <property name="from" value="${mail.default.from}" />
>         <aop:scoped-proxy>
>     </bean>
>
> P.S
> I'm sorry for my bad English :))
>
> Marat Kamalov.
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net

Reply via email to