java - Optional redis session storage for Spring MVC Project -
i want use spring-session store users' session data in central location redis server load balancing without needing sticky sessions.
spring supports few lines:
config.java
@enableredishttpsession public class config { @bean public jedisconnectionfactory connectionfactory() { return new jedisconnectionfactory(); } }
and initializer.java
public class initializer extends abstracthttpsessionapplicationinitializer { }
however, i'm tightly coupled redis in development environments, , every single deployment make. might want use redis in 1 high-traffic deployment of software.
i tried using spring profiles (added @profile("redissessions")
config.java) there's no way can tell servlet container not pick initializer.java (which causes application fail startup if config.java excluded through @profile
).
the end result want if had put @profile("redissessions")
on initializer.java class (which don't think possible) or there can swap jedisconnectionfactory out for, delegate sort of internal (or servlet container) mechanism?
Comments
Post a Comment