Spring Transactional annotation make bean unusable


I have Kotlin class

open class NewsRecordProcessor @Autowired constructor(private val newsChecker: NewsChecker,
private val originNewsController: OriginNewsRecordController,
private val directoryProcessor: DirectoryProcessor) {…}

In this case it’s ok.
But I need to start transaction at one method begining. And then I’m adding


It’s no metter where am I put it, before function declaration or before class declaration. As soon annotation is putted all autowired fields are null. This bean also autowired in another bean, but it seams constructor with parameters wasn’t call
or fields is set to another proxy class.

What can I do to fix it?


Same problem over here. Just contacted the Spring Data project lead. The behaviour of @Transactional on Kotlin classes is a complete mystery for me. Anything you found out so far?


It sounds like the project hasn’t been built using the “all open” (or related) compiler plugin.

See https://kotlinlang.org/docs/reference/compiler-plugins.html

You might try start.spring.io to create a starter project for reference?