Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-7078

make @Immutable play nice with constructor injection

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.6
    • 2.5.0-beta-3
    • xforms
    • None

    Description

      I have some Spring services that take injected components, and I use constructor injection whenever possible. These services can't be reconfigured after startup, and usually make the fields final.

      I would like to be able to use @Immutable to automatically generate the constructors and related plumbing for me, but @Immutable creates two, one that takes a Map and one that takes regular arguments. Spring/CDI can't resolve a single constructor and won't inject.

      Would it be feasible to have a way to add an annotation like @Inject to the generated tuple constructor, or is there another way that I can make an @Immutable class eligible for injection?

      Attachments

        Activity

          People

            paulk Paul King
            chrylis Christopher Smith
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: