I have an application which is quite old (7 years back-2014) but well built using JSF, Spring Webflow and Hibernate. This application is critical as being deployed for 50 separate clients each with different box (with tomcat as web server).
Now I want to change the architecture and move to multi tenancy in web module (JSF, Spring Webflow) i.e. Same web application mutualized for multiple clients with Super Admin module. But in backend will keep one database per client. For this I have decided to choose any one the the below approaches :
Approach 1 : Modify the web module and implement dynamic database routing to load application with multiple datasources and in which client will be able to switch to specific datasource dynamically through web interface.
Challenge - Technical feasibility without impacting the functional part.
Approach 2 : Keep the web module as it is and move to containers with container per datasource and user another super admin interface for client to connect to specific datasource.
Challenge - Orchestration and Will need to maintain authentication and access different apps using SSO or something better.
I want to go for second approach as it would be the one with least functional impact. Need some insight on what would the better approach or if someone have any suggestions w.r.t to Design, JSF or Spring Webflow compatibility with dynamic datasource.