I have an application that is integrated with Spring and a new requirement
is forcing me to update user login status for all users on  application
restart.

I want  to do this using  Springs JdbcOperations to do a simple execute of a
sql statement since Spring and Spring JPA are used throughout the
application.

The Application's init() method seems like a good place to do it since that
method runs whenever the application is started.

The problem I ran into is that my JdbcOperations instance is not injected
into the Application class instance so the init method throws a null pointer
exception.

I am able to inject JdbcOperations and lots of other things in my web pages,
but apparently, Spring has not yet been initialized when the Application's
init method is called. I suppose I could do something outside of Spring, but
that would make it inconsistent with the rest of the application.

Does anybody have any idea how to work around this? Is there any other place
later in the lifecycle of starting the application where I could do this?

 

Thanks,

Bruce

Reply via email to