使用 Watson spring-boot-starter 时查找 bean 时出错

Error finding bean when using Watson spring-boot-starter

我按照 https://github.com/watson-developer-cloud/spring-boot-starter 中的步骤尝试在 Spring 引导应用程序中调用 Watson Conversation(Assistant) 服务,但是我收到此错误:

*************************** APPLICATION FAILED TO START


Description:

Field service in application.ConverseApiBinding required a bean of type 'com.ibm.watson.developer_cloud.conversation.v1.Conversation' that could not be found.

Action:

Consider defining a bean of type 'com.ibm.watson.developer_cloud.conversation.v1.Conversation' in your configuration.

除了添加依赖项(我使用了 maven)和

,我还需要做其他事情吗
@Autowired
protected Conversation service;

服务 url 和凭据在 VCAP_SERVICES 环境变量中提供。

您的应用程序属性文件中需要有一些东西来表示应该创建对话 bean。通常这是服务凭证。

如果服务凭证来自 VCAP_SERVICES,您可以简单地指定 watson.conversation.enabled=true 在您的应用程序属性文件中。那应该会触发 bean 的创建。