Skip to content

io microsphere i18n spring PropertySourcesServiceMessageSource

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

PropertySourcesServiceMessageSource

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

Source: microsphere-i18n-spring/src/main/java/io/microsphere/i18n/spring/PropertySourcesServiceMessageSource.java

Overview

Spring PropertySources ServiceMessageSource that loads i18n messages from Spring Environment properties and supports runtime reloading.

Example Usage

`PropertySourcesServiceMessageSource source = new PropertySourcesServiceMessageSource("test");
  source.setEnvironment(environment);
  source.setSupportedLocales(Arrays.asList(Locale.getDefault(), Locale.ENGLISH));
  source.init();
  String propertyName = source.getPropertyName(Locale.ENGLISH);
`

Declaration

public class PropertySourcesServiceMessageSource extends PropertiesResourceServiceMessageSource implements

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

PropertySourcesServiceMessageSource source = new PropertySourcesServiceMessageSource("test");
  source.setEnvironment(environment);
  source.setSupportedLocales(Arrays.asList(Locale.getDefault(), Locale.ENGLISH));
  source.init();
  String propertyName = source.getPropertyName(Locale.ENGLISH);

Usage

Maven Dependency

Add the following dependency to your pom.xml:

<dependency>
    <groupId>io.github.microsphere-projects</groupId>
    <artifactId>microsphere-i18n-spring</artifactId>
    <version>${microsphere-i18n.version}</version>
</dependency>

Tip: Use the BOM (microsphere-i18n-dependencies) for consistent version management. See the Getting Started guide.

Import

import io.microsphere.i18n.spring.PropertySourcesServiceMessageSource;

API Reference

Public Methods

Method Description
getPropertyName Constructs with the given source identifier.
getPropertyName Gets the property name for the specified resource.
setEnvironment
findAllPropertySourcesServiceMessageSources Find all PropertySourcesServiceMessageSource beans from the specified BeanFactory
findAllPropertySourcesServiceMessageSources Find all PropertySourcesServiceMessageSource beans from the specified ServiceMessageSource ServiceMessageSources
reloadAll Reload all PropertySourcesServiceMessageSource beans from the specified BeanFactory

Method Details

findAllPropertySourcesServiceMessageSources

public static List<PropertySourcesServiceMessageSource> findAllPropertySourcesServiceMessageSources(BeanFactory beanFactory)

Find all PropertySourcesServiceMessageSource beans from the specified BeanFactory

findAllPropertySourcesServiceMessageSources

public static List<PropertySourcesServiceMessageSource> findAllPropertySourcesServiceMessageSources(
            Collection<? extends ServiceMessageSource> serviceMessageSources,
            Predicate<? super PropertySourcesServiceMessageSource>... predicates)

Find all PropertySourcesServiceMessageSource beans from the specified ServiceMessageSource ServiceMessageSources filtered by the specified Predicate predicates

reloadAll

public static void reloadAll(BeanFactory beanFactory, Set<String> changedPropertyNames)

Reload all PropertySourcesServiceMessageSource beans from the specified BeanFactory


This documentation was auto-generated from the source code of microsphere-i18n.

Clone this wiki locally