Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.5-RC6
    • Component/s: wicket-spring
    • Labels:
      None

      Description

      Please support 'required' in @SpringBean like @Autowired does...

      1. foobar.zip
        8 kB
        manthos
      2. springBeanRequired.txt
        7 kB
        Andrea Del Bene
      3. springBeanRequiredRefactored.txt
        14 kB
        Andrea Del Bene

        Activity

        Hide
        Martin Grigorov added a comment -

        Thank you, Andrea!

        Show
        Martin Grigorov added a comment - Thank you, Andrea!
        Hide
        Andrea Del Bene added a comment -

        Hi Martin,

        thank you for having pointed out these design problems. Some functions (like getBeanNameOfClass) were exactly the same both in APFVF and SBL. I've refactored them in order to remove code replication.
        Now APFVF is responsible of retrieving bean name according to its annotation or type. SBL is responsible of accessing bean details like singleton nature or bean name.
        Let me know if you think we can further decouple APFVF and SBL.

        PS: patch includes also e little fix for method getBean(Class<T> requiredType) of class ApplicationContextMock.

        Show
        Andrea Del Bene added a comment - Hi Martin, thank you for having pointed out these design problems. Some functions (like getBeanNameOfClass) were exactly the same both in APFVF and SBL. I've refactored them in order to remove code replication. Now APFVF is responsible of retrieving bean name according to its annotation or type. SBL is responsible of accessing bean details like singleton nature or bean name. Let me know if you think we can further decouple APFVF and SBL. PS: patch includes also e little fix for method getBean(Class<T> requiredType) of class ApplicationContextMock.
        Hide
        Martin Grigorov added a comment -

        The patch works but it looks like a workaround to me.
        This new feature shows that AnnotProxyFieldValueFactory and SpringBeanLocator share common responsibilities - finding the bean. APFVF has logic to find the bean to just extract its name and SBL to find the bean instance, its type, its definition, ...
        I think they have to be refactored to have better defined responsibilities.
        wicket-guice contains all the logic for finding a bean and its propeties in the locator implementation.

        Show
        Martin Grigorov added a comment - The patch works but it looks like a workaround to me. This new feature shows that AnnotProxyFieldValueFactory and SpringBeanLocator share common responsibilities - finding the bean. APFVF has logic to find the bean to just extract its name and SBL to find the bean instance, its type, its definition, ... I think they have to be refactored to have better defined responsibilities. wicket-guice contains all the logic for finding a bean and its propeties in the locator implementation.
        Hide
        Andrea Del Bene added a comment -

        I'm writing an email about it on dev mailing list.

        Show
        Andrea Del Bene added a comment - I'm writing an email about it on dev mailing list.
        Hide
        manthos added a comment -

        @Andera: Thanks for the patch.

        @Martin: Any news to apply it? Would be great to have this in 1.5...

        Show
        manthos added a comment - @Andera: Thanks for the patch. @Martin: Any news to apply it? Would be great to have this in 1.5...
        Hide
        Andrea Del Bene added a comment -

        Here is a patch with an implementation of this improvement. Patch includes a test case called SpringBeanTest which performs some tests on this annotation and on this new feature.

        Show
        Andrea Del Bene added a comment - Here is a patch with an implementation of this improvement. Patch includes a test case called SpringBeanTest which performs some tests on this annotation and on this new feature.
        Hide
        manthos added a comment -

        I've attached a sample project.
        Please see explanation in /src/main/java/web/HomePage.java
        Hope this helps to clarify...

        Show
        manthos added a comment - I've attached a sample project. Please see explanation in /src/main/java/web/HomePage.java Hope this helps to clarify...
        Hide
        manthos added a comment -

        Please see explanation in /src/main/java/web/HomePage.java

        Show
        manthos added a comment - Please see explanation in /src/main/java/web/HomePage.java
        Hide
        Martin Grigorov added a comment -

        Can you give more details, please ?
        A demo application or a failing test case would be nice.

        Show
        Martin Grigorov added a comment - Can you give more details, please ? A demo application or a failing test case would be nice.

          People

          • Assignee:
            Martin Grigorov
            Reporter:
            manthos
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development