mirror of
https://github.com/CodePhiliaX/Chat2DB.git
synced 2025-08-02 21:50:43 +08:00
Optimize startup speed
This commit is contained in:
@ -7,6 +7,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.NoSuchMessageException;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -18,8 +19,9 @@ import org.springframework.stereotype.Component;
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@Lazy(value = false)
|
||||
public class I18nUtils implements InitializingBean {
|
||||
public static final String DEFAULT_message_Code="common.systemError";
|
||||
public static final String DEFAULT_MESSAGE_CODE="common.systemError";
|
||||
@Resource
|
||||
private MessageSource messageSource;
|
||||
private static MessageSource messageSourceStatic;
|
||||
@ -34,7 +36,7 @@ public class I18nUtils implements InitializingBean {
|
||||
} catch (NoSuchMessageException e) {
|
||||
log.error("no message.", e);
|
||||
}
|
||||
return messageSourceStatic.getMessage(DEFAULT_message_Code, args, LocaleContextHolder.getLocale());
|
||||
return messageSourceStatic.getMessage(DEFAULT_MESSAGE_CODE, args, LocaleContextHolder.getLocale());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user