Задать вопрос
@artemfisher

Почему @ConfigurationPropertiesBinding не работает на уровне @Bean-метода?

В документации сказано:
You may want to rename your custom ConversionService if it is not required for configuration keys coercion and only rely on custom converters qualified with @ConfigurationPropertiesBinding. When qualifying a bean method with @ConfigurationPropertiesBinding, the method should be static to avoid “bean is not eligible for getting processed by all BeanPostProcessors” warnings.


https://docs.spring.io/spring-boot/reference/featu...

Делаю:
@SpringBootApplication
@ConfigurationPropertiesScan
public class MyApp 
{		
		
	public static void main(String[] args) {		
				
		SpringApplication app = new SpringApplication(MyApp.class);		
		app.run(args);		
	}	
	
	
	@Bean
	@ConfigurationPropertiesBinding
	public static ConversionService myConversionService()
	{
		var service = new DefaultConversionService();
		service.addConverter(new MyConverter());
		return service;
	}	
}


Выдает исключение:
No converter found capable of converting from type [java.lang.String] to type [mainPackage.Group$Student]
  • Вопрос задан
  • 5 просмотров
Подписаться 1 Простой Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы