Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7559557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:40:05+00:00 2026-05-30T12:40:05+00:00

I have a Spring MVC webapp and want to do this (example): Request to

  • 0

I have a Spring MVC webapp and want to do this (example):

  • Request to subdomain en.foo.com -> language should be English
  • Request to subdomain es.foo.com -> language should be Spanish

I already use the localeChangeInterceptor to change the language by URL parameter on request, and this works (adding a parameter e.g. ?lang=en to my URLs).

But what is the best way to have language-specific subdomains with Spring? I searched the web and Spring documentation, but have yet to find an answer.

I think it could work like this:

  1. Intercept any request
  2. Determine used subdomain
  3. Decide which language/locale should be used and set it like the localeChangeInterceptor does

If this is the way to go, I could use a hint where to start.

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T12:40:06+00:00Added an answer on May 30, 2026 at 12:40 pm

    You will want to implement your own LocaleResolver.

    The LocaleResolver.resolveLocale(HttpServletRequest) method is what Spring uses to determine which Locale to use from the MessageSource. You can extract the subdomain from the request and return the desired Locale.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a controller (Spring-MVC) that generates a PDF report on a get request.
Is it possible to have multiple resource bundles in spring mvc? I want to
I have a small Spring MVC webapp (which embeds ActiveMQ) that is designed to
I have a Java/Spring MVC/JSP/JSTL webapp. We have a designer that gave us some
I am developing a webapp using Spring MVC 3 and have the DispatcherServlet catching
I'm running a webapp in Spring Web MVC 3.0 and I have a number
i have written a small webapp using spring-security and spring-mvc with an annotation based
I am using Spring MVC to develop a Java webapp. I have a setup
I have read this tutorial to write my hello world application with spring mvc.But
I have a Spring-MVC based webapp with a JSP front end. It is your

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.