开发者

How to handle multiple subdomains separately in a Spring MVC app?

Su开发者_如何学Cpposing I have two subdomains:

Products:

products.example.com

Users:

users.example.com

How do I set up a single Spring MVC app to handle each of these domains differently (in my case I want to use a different database depending on which subdomain the user arrives from)?


If the same applications is to be used with the multiple subdomains, then you can make an interceptor (implement HandlerInterceptor) that is invoked for every request and store the subdomain in a ThreadLocal. Then, based on that value, you can differentiate your actions.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜