Class doesn't contain matching constructor for autowiring

Answered

IntelliJ is giving me the error in the title for the following Kotlin code in a Spring Boot project:

@Service
class JedisCacheRepository(
private final val redisProperties: RedisProperties,
private final val jedisCachePoolFactory: JedisCachePoolFactory
) {
constructor(redisProperties: RedisProperties): this(redisProperties, DefaultJedisCachePoolFactory())

// ...
}

Removing the secondary constructor makes the problem go away.

There is no error at runtime, the code works correctly.

Is this a false positive from IntelliJ or a real problem and it just happens to work... for now...?

 

0

Please sign in to leave a comment.