java.lang.IllegalStateException: Unable to read meta-data for class

问题报错的背景

我在打包框架的底层代码,在其他项目中引入该框架的时候,无法自动注入底层框架中 bean 对象,导致报错
注意:需要注入外部 bean 对象,需要在底层框架那里加个 spring.factories 文件
在这里插入图片描述

书写格式很重要

spring.factories 格式很重要!!!

两个方式都是错误
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.eastcom_sw.frm.auth.service.AsyncLogService,\
com.eastcom_sw.frm.auth.config.RestTemplateConfig,

org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.eastcom_sw.frm.auth.service.AsyncLogService,
com.eastcom_sw.frm.auth.config.RestTemplateConfig
正确
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.eastcom_sw.frm.auth.service.AsyncLogService,\
com.eastcom_sw.frm.auth.config.RestTemplateConfig
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐