https://kotlinlang.org logo
#spring
Title
# spring
c

Cru

03/02/2023, 5:31 PM
Is there a convenient way to make
@Component
annotations work with kotlin objects and automatically make that bean a singleton? I typically create a wrapper class to annotate as
@Component
to wrap my kotlin objects.
j

Jacob

03/02/2023, 5:34 PM
you mean the
object
keyword kind of object?
c

Cru

03/02/2023, 5:39 PM
yes
j

Jacob

03/02/2023, 5:43 PM
Why bother adding the @Component? The object will already be available to any code that needs it without any Dependency Injection
4
21 Views