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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -