[英]auto-configure ClientRegistrationRepository in a non-web Spring Boot application
[英]How to auto-configure ConversionService in non-web Spring environment?
我有一个带有spring-boot
的非网络环境,因为我只需要一些类:
spring.main.web-application-type=none
问题:我如何告诉 spring 自动配置org.springframework.core.convert.ConversionService
(例如,我需要@Entity
对象的@Convert
自动映射)?
当我尝试自动连接对话服务时,它失败了:
@Autowired
private ConversionService conversionService;
public void fetch() {
BeanPropertyRowMapper.newInstance(MyObject.class, conversionService));
}
required a bean of type 'org.springframework.core.convert.ConversionService' that could not be found.
您可以自动装配 ConfigurableEnvironment 并从那里获取转换服务。 如果您想直接使其可用,请将其放入 Bean 方法中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.