How to Inject session bean in custom spring security login success handler -
i'm unable inject spring session bean in custom success handler:
@component public class customsavedrequestawareauthenticationsuccesshandler extends savedrequestawareauthenticationsuccesshandler { @resource private sessioncontroller sessioncontroller; @override public void onauthenticationsuccess(httpservletrequest request, httpservletresponse response, authentication authentication) throws servletexception, ioexception { super.onauthenticationsuccess(request, response, authentication); sessioncontroller.setutenteonline(); }
that return null pointer exception on sessioncontroller. thank in advance
your success handler singleton can inject singletons reliably. can solve problem using scoped dependencies. basically, involves spring injecting singleton dynamic proxy manages fetching real bean session scope , delegating calls it.
Comments
Post a Comment