将发送到电报机器人的聊天 ID 和文本保存在数据库中

Save chatID and text sent to a telegram bot, in a database

我正在开发一个 springboot 应用程序,我在其中通过令牌和用户名注册机器人,我只是在 class 中编写了一些代码来扩展 TelegramLongPollingBot

@Autowired
BotService botService;
        .
        .
        .
if (certain Condition is met )) {
//send the text i retrieved from the bot api which is called command and access the service class and use it to create a ticket
    botService.createTicket(command);

但我总是得到的是: Cannot invoke "BotService.createTicket(String)" because "this.BotService is null" 不仅是服务 class,我尝试从这个 class 访问的任何内容都会给我一个 NullPointerException

注意事项一切正常,只是我无法将从机器人 api 收到的消息发送到我的服务 class 或从 [=23 内部调用的任何其他东西=].

我需要知道如何在不获取空指针的情况下调用 class,从而将我需要的信息保存在数据库中。 谢谢!!

错误来自依赖关系,我没有得到 spring-boot-telegram 依赖关系,而是得到了正常的 org.telegram 依赖关系。