Skip to content

Kotlin examples for setter injection incorrectly use field injection #28596

@sbrannen

Description

@sbrannen

While analyzing #28590, I noticed that many of the examples involving setter injection and Kotlin incorrectly use field injection.

Searching for lateinit var movieFinder: MovieFinder will reveal several of those -- for example, those using @Resource, @Autowired, @Inject.

There may well be other cases in the reference manual.


Regarding the "fix", #28590 proposed the @Required set shorthand syntax for annotating a setter method in Kotlin. I'm not a Kotlin expert and therefore assume that works, but I'm wondering if it wouldn't be better to demonstrate annotated setter methods with a complete setXyz(...) method.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions