generated at
オートワイヤリングのエラーを解決する
SpringBootを利用したLINEBotの作成
Callback.java
package com.example.linebot.presentation; import com.example.linebot.presentation.replier.Follow; import com.example.linebot.service.JankenResult; import com.example.linebot.service.JankenService; import com.linecorp.bot.model.event.FollowEvent; import com.linecorp.bot.model.event.message.ImageMessageContent; import com.linecorp.bot.model.message.Message; import com.linecorp.bot.model.message.TextMessage; import com.linecorp.bot.spring.boot.annotation.EventMapping; import com.linecorp.bot.spring.boot.annotation.LineMessageHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.linecorp.bot.model.event.message.TextMessageContent; import com.linecorp.bot.model.event.MessageEvent; import com.example.linebot.presentation.replier.Parrot; import java.util.List; @LineMessageHandler public class Callback { private static final Logger log = LoggerFactory.getLogger(Callback.class); private JankenService jankenService; public Callback(JankenService jankenService){ this.jankenService = jankenService; } @EventMapping public List<Message> handleJanken(MessageEvent<ImageMessageContent> event) throws Exception { JankenResult jankenResult = jankenService.doJanken(event); return List.of(new TextMessage("handleJanken が呼び出された")); } }

オートワイヤリングできませんでした。'JankenService' 型の Bean が見つかりません。」
import com.example.linebot.service.JankenService; と書いているのだが、見つけられていない模様

計算基礎論のテストがやばいので後回しにしよう

@ComponentScan("com.example.linebot.service") というアノテーションを書いたら解決した
Callback.java
@LineMessageHandler @ComponentScan("com.example.linebot.service") public class Callback {以下略