-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
是否可以根据 配置文件是否有相应配置来建立 bean #72
Comments
不清楚什么场景会出现这种情况。我个人觉得没有配置算是很严重的问题,所以倾向于启动时提前暴露问题。 |
@conditionalonproperty 可以考虑支持 |
场景是我想将一些经常用的API封装成自己的starter方便引入调用,但是这些API不是每个应用都需要用到,所以想通过是否经过了配置来决定是否生成bean。已经自定义重写了 AutoConfiguredRetrofitScannerRegistrar 和 ClassPathRetrofitClientScanner 来解决了这个问题,但是编码有些硬,想知道有没有更好的方法。 |
***@***.***来支持吧。如果有这个注解,属性不存在就不加载。
…------------------ 原始邮件 ------------------
发件人: "LianjiaTech/retrofit-spring-boot-starter" ***@***.***>;
发送时间: 2021年8月5日(星期四) 下午3:09
***@***.***>;
***@***.******@***.***>;
主题: Re: [LianjiaTech/retrofit-spring-boot-starter] 是否可以根据 配置文件是否有相应配置来建立 bean (#72)
场景是我想将一些经常用的API封装成自己的starter方便引入调用,但是这些API不是每个应用都需要用到,所以想通过是否经过了配置来决定是否生成bean。已经自定义重写了 AutoConfiguredRetrofitScannerRegistrar 和 ClassPathRetrofitClientScanner 来解决了这个问题,但是编码有些硬,想知道有没有更好的方法。
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@RetrofitClient(baseUrl = "${test.baseUrl}")
public interface HttpApi {
}
如果yml中没有test.baseUrl 能否不创建bean,而是提示一个警告?
或者用@conditionalonproperty 来作判断?
或者 baseURL 支持 SpEL?
The text was updated successfully, but these errors were encountered: