Код: Выделить всё
@ConfigurationProperties(prefix = "commons.time.formats")
@Getter
@Setter
public class TimeFormatConf {
... fields
}
Код: Выделить всё
@Component
@Configuration
@AllArgsConstructor
@EnableConfigurationProperties(TimeFormatConf.class)
@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE)
public class DateTimeConfigurer {
private final TimeFormatConf timeFormatConf;
@EventListener(ApplicationReadyEvent.class)
public void configureTimeFormat() {
TimeZone.setDefault(TimeZone.getTimeZone(timeFormatConf.getDynamicZone()));
System.setProperty("user.timezone", timeFormatConf.getDynamicZone());
}
}
Код: Выделить всё
src/main/resources/META-INF/spring.factoriesКод: Выделить всё
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
[package].DateTimeConfigurer,\
...
Параметру 0 конструктора в com.some.package.b.Class требовался bean-компонент
типа com.some.package.a.TimeFormatConf, который не удалось найти.
Артефакт присутствует в правильной конфигурации в пути к классам. Поэтому он должен что-то делать либо с объявлением, либо с настройкой Spring.
Я также пробовал добавить @Component в класс свойств и @ComponentScan в класс конфигурации. не имеет никакого эффекта.
Возврат к Spring Boot 2.7.7 в обоих проектах устранил проблему. Так что, похоже, это ошибка или, по крайней мере, отсутствие документации. Я открыл проблему, чтобы обсудить это с командой Spring: https://github.com/spring-projects/spri ... sues/33720
Подробнее здесь: https://stackoverflow.com/questions/750 ... ties-beans
Мобильная версия