Skip to content

io microsphere i18n spring validation beanvalidation I18nLocalValidatorFactoryBeanPostProcessor

github-actions[bot] edited this page Jul 9, 2026 · 12 revisions

I18nLocalValidatorFactoryBeanPostProcessor

Type: Class | Module: microsphere-i18n-spring | Package: io.microsphere.i18n.spring.validation.beanvalidation | Since: 1.0.0

Source: microsphere-i18n-spring/src/main/java/io/microsphere/i18n/spring/validation/beanvalidation/I18nLocalValidatorFactoryBeanPostProcessor.java

Overview

Internationalization BeanPostProcessor for LocalValidatorFactoryBean that sets the i18n MessageSourceAdapter as the validation message source.

Example Usage

{@code
  // Automatically registered via @EnableI18n when Jakarta Validation API is on classpath
  // Associates LocalValidatorFactoryBean with the i18n MessageSourceAdapter

### Declaration

```java
public class I18nLocalValidatorFactoryBeanPostProcessor extends GenericBeanPostProcessorAdapter
```

**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 Jakarta Validation API is on classpath
  // Associates LocalValidatorFactoryBean with the i18n MessageSourceAdapter
  @EnableI18n
  @Configuration
  public class AppConfig { }
```

## 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.validation.beanvalidation.I18nLocalValidatorFactoryBeanPostProcessor;
```

## API Reference

### Public Methods

| Method | Description |
|--------|-------------|
| `isValidatorFactoryPresent` | Constructs with the given `MessageSourceAdapter` provider. |

### Method Details

#### `isValidatorFactoryPresent`

```java
public static boolean isValidatorFactoryPresent(ClassLoader classLoader)
```

Constructs with the given `MessageSourceAdapter` provider.

## See Also

- `LocalValidatorFactoryBean#setValidationMessageSource(MessageSource)`
- `MessageSourceAdapter`
- `EnableI18n`

---

*This documentation was auto-generated from the source code of [microsphere-i18n](https://github.com/microsphere-projects/microsphere-i18n).*

Clone this wiki locally