启动holdion-mp应用程序时出现此错误,这是代码段。
模型类:
公共类EnvironmentInfo实现Serializable {
private String releaseVersion;
private String environmentType;
private String environmentSize;
private boolean breakGlassEnabled;
//获取器和设置器
资源类:@Path(“ / environmentInfo”)公共类EnvironmentInfoResource {
@Inject
@Named("ApplicationDS")
PoolDataSource dataSource;
//从application.yaml获取数据库属性。
无法启动服务器,出现错误。线程“主”中的异常org.jboss.weld.exceptions.DeploymentException:WELD-001408:类型为PoolName的@Named的不满足的PoolDataSource依赖关系在注入点[BackedAnnotatedField] @Inject @Named oracle.topologymanager.environmentinfo.resource.EnvironmentInfoResource.dataSource
根据Helidon MP docs,注入数据源以声明DataSource
字段,而不是PooledDataSource
,
尝试:
@Path("/environmentInfo")
public class EnvironmentInfoResource {
@Inject
@Named("ApplicationDS")
DataSource dataSource;
// ...
}