Closed chenhuwo closed 4 years ago
配置中心的配置
spring.datasource.type=druid
这个配置对应的Class
@ConfigurationProperties(prefix = "spring.datasource")
public class DataSourceProperties implements BeanClassLoaderAware, InitializingBean {
//其他省略
private Class<? extends DataSource> type;
}
启动的时候会出现上述的错误
Failed to bind properties under 'spring.datasource.type' to java.lang.Class<javax.sql.DataSource>:
Property: spring.datasource.type
Value: com.alibaba.druid.pool.DruidDataSource
Origin: "spring.datasource.type" from property source "ApolloBootstrapPropertySources"
Reason: No converter found capable of converting from type [java.lang.String] to type [java.lang.Class<javax.sql.DataSource>]
这个和apollo没啥关系,google参考一下吧
This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed in 14 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions.
This issue has been automatically closed because it has not had activity in the last 14 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted". Thank you for your contributions.
DataSourceProperrties的type属性是Class类型,springboot中可以转换成Class,此处该如何转换,或者我重新写个配置也可以。