diff --git a/microsphere-i18n-spring-boot/src/main/java/io/microsphere/i18n/spring/boot/autoconfigure/I18nAutoConfiguration.java b/microsphere-i18n-spring-boot/src/main/java/io/microsphere/i18n/spring/boot/autoconfigure/I18nAutoConfiguration.java index e8ce00b..b1fbeac 100644 --- a/microsphere-i18n-spring-boot/src/main/java/io/microsphere/i18n/spring/boot/autoconfigure/I18nAutoConfiguration.java +++ b/microsphere-i18n-spring-boot/src/main/java/io/microsphere/i18n/spring/boot/autoconfigure/I18nAutoConfiguration.java @@ -17,7 +17,11 @@ package io.microsphere.i18n.spring.boot.autoconfigure; import io.microsphere.i18n.spring.annotation.EnableI18n; +import io.microsphere.i18n.spring.beans.factory.ServiceMessageSourceFactoryBean; import io.microsphere.i18n.spring.boot.condition.ConditionalOnI18nEnabled; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Bean; /** * I18n Auto-Configuration @@ -28,4 +32,11 @@ @ConditionalOnI18nEnabled @EnableI18n public class I18nAutoConfiguration { + + @Bean + @ConditionalOnProperty(name = "spring.application.name") + public ServiceMessageSourceFactoryBean applicationServiceMessageSource( + @Value("${spring.application.name}") String applicationName) { + return new ServiceMessageSourceFactoryBean(applicationName); + } }