-
Notifications
You must be signed in to change notification settings - Fork 18
io microsphere i18n spring web servlet AcceptHeaderLocaleResolverBeanPostProcessor
github-actions[bot] edited this page Jul 9, 2026
·
12 revisions
Type: Class | Module: microsphere-i18n-spring | Package: io.microsphere.i18n.spring.web.servlet | Since: 1.0.0
The BeanPostProcessor to set the default Locale and supported Locale locales
into AcceptHeaderLocaleResolver from the ServiceMessageSource configuration.
{@code
// Automatically registered via @EnableI18n when Spring Web MVC is on classpath
// Configures AcceptHeaderLocaleResolver with i18n-supported locales
### Declaration
```java
public class AcceptHeaderLocaleResolverBeanPostProcessor extends GenericBeanPostProcessorAdapter implements ApplicationContextAware
```
**Author:** Mercy
## Version Information
- **Introduced in:** `1.0.0`
- **Current Project Version:** `0.2.17-SNAPSHOT`
## Version Compatibility
This component is tested and compatible with the following Java versions:
| Java Version | Status |
|:---:|:---:|
| Java 17 | ✅ Compatible |
| Java 21 | ✅ Compatible |
| Java 25 | ✅ Compatible |
## Examples
```java
// Automatically registered via @EnableI18n when Spring Web MVC is on classpath
// Configures AcceptHeaderLocaleResolver with i18n-supported locales
@EnableI18n
@Configuration
public class WebConfig { }
```
## Usage
### Maven Dependency
Add the following dependency to your `pom.xml`:
```xml
io.github.microsphere-projects
microsphere-i18n-spring
${microsphere-i18n.version}
```
> **Tip:** Use the BOM (`microsphere-i18n-dependencies`) for consistent version management. See the [Getting Started](https://github.com/microsphere-projects/microsphere-i18n#getting-started) guide.
### Import
```java
import io.microsphere.i18n.spring.web.servlet.AcceptHeaderLocaleResolverBeanPostProcessor;
```
## API Reference
### Public Methods
| Method | Description |
|--------|-------------|
| `setApplicationContext` | |
| `isAcceptHeaderLocaleResolverPresent` | Checks whether `AcceptHeaderLocaleResolver` is present on the classpath. |
### Method Details
#### `isAcceptHeaderLocaleResolverPresent`
```java
public static boolean isAcceptHeaderLocaleResolverPresent(ClassLoader classLoader)
```
Checks whether `AcceptHeaderLocaleResolver` is present on the classpath.
## See Also
- `AcceptHeaderLocaleResolver`
- `AcceptHeaderLocaleResolver#setDefaultLocale(Locale)`
- `AcceptHeaderLocaleResolver#setSupportedLocales(List)`
- `EnableI18n`
---
*This documentation was auto-generated from the source code of [microsphere-i18n](https://github.com/microsphere-projects/microsphere-i18n).*
i18n-core
- AbstractResourceServiceMessageSource
- AbstractServiceMessageSource
- CompositeServiceMessageSource
- DefaultServiceMessageSource
- EmptyServiceMessageSource
- I18nUtils
- MessageUtils
- PropertiesResourceServiceMessageSource
- ReloadableResourceServiceMessageSource
- ResourceServiceMessageSource
- ServiceMessageException
- ServiceMessageSource
i18n-openfeign
i18n-spring
- AcceptHeaderLocaleResolverBeanPostProcessor
- DelegatingServiceMessageSource
- EnableI18n
- I18nApplicationListener
- I18nBeanUtils
- I18nConstants
- I18nImportBeanDefinitionRegistrar
- I18nLocalValidatorFactoryBeanPostProcessor
- LocaleUtils
- MessageSourceAdapter
- PropertySourcesServiceMessageSource
- ResourceServiceMessageSourceChangedEvent
- ServiceMessageSourceBeanLifecyclePostProcessor
- ServiceMessageSourceFactoryBean
i18n-spring-boot
i18n-spring-cloud
i18n-spring-cloud-server