Hi Alexei,
Could you please upload patches for your proposed improvement.
regards Malcolm Edgar
On Wed, Jul 16, 2008 at 2:09 PM, Alexei Sokolov
<
alexei.sokolov@...> wrote:
> package net.sf.click.extras.spring;
>
> import org.springframework.beans.factory.config.BeanDefinition;
> import org.springframework.context.annotation.ScopeMetadata;
> import org.springframework.context.annotation.ScopeMetadataResolver;
>
> public class PageScopeResolver implements ScopeMetadataResolver {
>
> private static final ScopeMetadata DEFAULT_PAGE_SCOPE =
> DEFAULT_PAGE_SCOPE();
>
> private static final ScopeMetadata DEFAULT_PAGE_SCOPE() {
> final ScopeMetadata value = new ScopeMetadata();
> value.setScopeName(BeanDefinition.SCOPE_PROTOTYPE);
> return value;
> }
>
> private ScopeMetadata pageScope = DEFAULT_PAGE_SCOPE;
>
> @Override
> public ScopeMetadata resolveScopeMetadata(BeanDefinition definition) {
> return pageScope;
> }
>
> public void setPageScope(ScopeMetadata pageScope) {
> this.pageScope = pageScope;
> }
>
> }
>
>
> On Tue, Jul 15, 2008 at 9:04 PM, Alexei Sokolov <
alexei.sokolov@...>
> wrote:
>>
>> Bonus:
>>
>> With the code attached to CLK-375 you need to specify @Scope annotation
>> for every page. But usually all pages will have same scope: "prototype" so
>> that new instance of the page is created every time page is requested. So I
>> wrote another class: PageScopeResolver. If you put the following xml
>> fragment in spring config:
>>
>> <context:component-scan
>> name-generator="net.sf.click.extras.spring.PageBeanNameGenerator"
>> scope-resolver="net.sf.click.extras.spring.PageScopeResolver"
>> base-package="com.clickweb.pages"/>
>>
>> then all of your pages will be created with scope="prototype" and you
>> don't need to annotate every page class with @Scope.
>>
>> Alex
>>
>> On Tue, Jul 15, 2008 at 12:12 PM, Alexei Sokolov
>> <
alexei.sokolov@...> wrote:
>>>
>>> Malcolm,
>>>
>>> Is there a chance for
http://www.avoka.com:8080/jira/browse/CLK-375 to be
>>> included in Milestone 2? Source code for JDK1.4 and spring framework 2.5 is
>>> included in the comments.
>>>
>>> Alex
>>
>
>