Wicket
  1. Wicket
  2. WICKET-3542

Support for JSR 330 annotations (@Inject, @Named)

    Details

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

      Description

      Currently wicket supports injection of dependencies using the SpringBean annotation. It would be nice to have an option to use JSR 330 annotations instead.

      Not much would need to change for this, just some changes in AnnotProxyFieldValueFactory.

      The SpringBean annotation would map directly to Inject and the "name" value could map to the Named annotation.

        Issue Links

          Activity

          Hide
          Martin Grigorov added a comment -

          Implemented with WICKET-4307 in Wicket 6.0

          Show
          Martin Grigorov added a comment - Implemented with WICKET-4307 in Wicket 6.0
          Hide
          Bruno Borges added a comment - - edited

          Yes, we recently had a discussion about this:

          http://apache-wicket.1842946.n4.nabble.com/Spring-Annotations-supoprt-for-IoC-on-WebPages-td3320087.html

          And I agree with not allowing that.

          Although, I would consider renaming @SpringBean to something else that could easily fit with CDI / Spring / Guice

          @WicketInject perhaps.

          And the IoC could be switched at WicketApplication class without complication (I think). It is not usual, and probably not recommended to have more than one IoC anyway.

          Show
          Bruno Borges added a comment - - edited Yes, we recently had a discussion about this: http://apache-wicket.1842946.n4.nabble.com/Spring-Annotations-supoprt-for-IoC-on-WebPages-td3320087.html And I agree with not allowing that. Although, I would consider renaming @SpringBean to something else that could easily fit with CDI / Spring / Guice @WicketInject perhaps. And the IoC could be switched at WicketApplication class without complication (I think). It is not usual, and probably not recommended to have more than one IoC anyway.
          Hide
          Igor Vaynberg added a comment -

          this may be a dangerous thing, using a custom annotation has its advantages.

          for example, if we use the standard @Inject and the spring project is using aspect then wicket components will be instrumented by aspectj instead of wicket. obviously, this is undesirable. users will have to add exclusions into their package-scanning config, etc.

          Show
          Igor Vaynberg added a comment - this may be a dangerous thing, using a custom annotation has its advantages. for example, if we use the standard @Inject and the spring project is using aspect then wicket components will be instrumented by aspectj instead of wicket. obviously, this is undesirable. users will have to add exclusions into their package-scanning config, etc.
          Hide
          Steve Jones added a comment -

          Updated wicket files that implement this functionality (obviously it would be cleaner to make changes to the existing files rather than largely duplicating them)

          Show
          Steve Jones added a comment - Updated wicket files that implement this functionality (obviously it would be cleaner to make changes to the existing files rather than largely duplicating them)
          Hide
          Martin Grigorov added a comment -

          Patch is welcome.
          Can be applied to Guice as well.
          Don't drop support for @SpringBean and Guice's Inject - there are people relying on them.

          Show
          Martin Grigorov added a comment - Patch is welcome. Can be applied to Guice as well. Don't drop support for @SpringBean and Guice's Inject - there are people relying on them.

            People

            • Assignee:
              Unassigned
              Reporter:
              Steve Jones
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development