How does Spring Boot support internationalization (i18n)?

Spring Boot supports Internationalization (i18n) by allowing applications to display messages in multiple languages based on the user's locale or language preference. It uses locale-specific resource files and automatically resolves the appropriate language at runtime.

Key Points

Example

Consider an e-commerce application used by customers in different countries.

English User

Welcome to our application

French User

Bienvenue dans notre application

German User

Willkommen in unserer Anwendung

The application displays messages according to the user's selected language without changing the application code.

messages.properties

welcome.message=Welcome to our application

messages_fr.properties

welcome.message=Bienvenue dans notre application

messages_de.properties

welcome.message=Willkommen in unserer Anwendung

Accessing Messages

@Autowired
private MessageSource messageSource;
String message = messageSource.getMessage(
        "welcome.message",
        null,
        Locale.FRANCE);

Core Components

1. MessageSource

2. LocaleResolver

3. LocaleChangeInterceptor

Example

http://localhost:8080/home?lang=fr

This changes the application language to French.

Configuration Example

@Bean
public LocaleResolver localeResolver() {

    SessionLocaleResolver resolver =
            new SessionLocaleResolver();

    resolver.setDefaultLocale(
            Locale.ENGLISH);

    return resolver;
}

Supported Message Files

Spring Boot automatically loads the correct file based on the user's locale.

Real-World Example

An airline booking application supports

Users see

in their preferred language.

Benefits

Interview Tip

A concise interview answer is: Spring Boot supports internationalization using locale-specific message property files, MessageSource for loading messages, and LocaleResolver for determining the user's language preference. Based on the user's locale, Spring Boot automatically displays messages in the appropriate language, making applications suitable for global users.

Last updated: 11 November 2026

Previous question: Can we create a non-web application in Spring Boot?

Next question: What is Spring Boot DevTools used for?

More Spring Boot - Level II interview questions

All Spring Boot - Level II questions