As reported by Denis in
https://issues.apache.org/jira/browse/TAP5-1765 per-thread
service builder method don't play well with parameters that are marked with
@Autobuild annotation.

The reason is that the method invocation plan for a service builder method
is created only once and stored. Also the method parameters are calculated
only once. This fact doesn't play well in a situation like this.


    @Scope(ScopeConstants.PERTHREAD)
    public static StringHolder buildStringHolder(@Autobuild
StringHolderImpl holder)
    {
        return holder;
    }

In the example above the plan of for the service builder method is invoked
for every new request, but because the same plan is reused again and again,
same StringHolderImpl is used as method parameter. The consequence is that
a per-thread service acts as a singleton.

My suggestion is to rebuild the plan for a service builder method if at
least one of the parameter is annotated with @Autobuild.

Any objections?

-- 
Best regards,

Igor Drobiazko
http://tapestry5.de

Reply via email to