Skip to content
Advertisement

using spring boot data redis template get a null pointer error

config:

JavaScript

use:

JavaScript

and this

JavaScript

always get a error, warn stack trace is:

JavaScript

I just want to use spring boot date redis to do some CRUD operations like template<String, Object>. please help me

Advertisement

Answer

Field injection can’t happen until after the constructor is already finished. Make the template a constructor parameter instead (and avoid field injection generally).

Advertisement