Переопределить bean-компонент localeResolver при весенней загрузке 3JAVA

Программисты JAVA общаются здесь
Anonymous
Переопределить bean-компонент localeResolver при весенней загрузке 3

Сообщение Anonymous »

Перед переходом на Spring Boot 3 я создал bean-компонент localeResolver следующим образом:

Код: Выделить всё

@Bean
public LocaleResolver localeResolver(MessageSourceProperties properties) {
CookieLocaleResolver clr = new CookieLocaleResolver(properties.getCookieName());
clr.setDefaultLocale(Locale.ENGLISH);
return clr;
}
Но сейчас этот компонент уже определен, и я получаю сообщение об ошибке:

Код: Выделить всё

The bean 'localeResolver', defined in class path resource [com/app/autoconfigure/internationalization/I18nAutoConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/web/servlet/config/annotation/DelegatingWebMvcConfiguration.class] and overriding is disabled.
Этот компонент создан в классе WebMvcConfigurationSupport.
Как его переопределить?

Подробнее здесь: https://stackoverflow.com/questions/755 ... ing-boot-3

Вернуться в «JAVA»