Why is it that @ Autowire annotations for third-party Twitter classes in Controller cannot be automatically injected?

this problem comes from the source code of the book "master springMVC 4". In the environment built with SpirngBoot 2, according to my understanding, the @ Autowired annotation generally cannot directly inject the classes under the third-party package (we cannot guarantee that the classes provided by the third party have been added with @ Component, and the package path can be scanned automatically). In the example, the org.springframework.social.twitter.api.Twitter interface is annotated with @ Autowired, but the current class is TwitterTemplate,. The two parameters of the constructor, TwitterTemplate (key,secretToken), come from the configuration of Application.properties, and according to the actual test, the following code does not work properly.

< H2 > the code is as follows: < / H2 >

package com.labs.app.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.social.twitter.api.SearchOperations;
import org.springframework.social.twitter.api.SearchResults;
import org.springframework.social.twitter.api.Twitter;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

public class TweetController {

@Autowired
private Twitter twitter;

@RequestMapping("/")
public String hello(@RequestParam(defaultValue="sb01") String search, Model model){
    SearchOperations so = twitter.searchOperations();
    String text = "INIT";
    if(null!=so){
        SearchResults sr = so.search(search);
        text = sr.getTweets().get(0).getText();
    }
    model.addAttribute("message", text);
    return "resultPage";
}

}

The error message obtained by < H2 > is as follows: < / H2 >

Description:

Field twitter in com.labs.drivingschool.controller.TweetController required a bean of type "org.springframework.social.twitter.api.Twitter" that could not be found.

Action:
Consider defining a bean of type "org.springframework.social.twitter.api.Twitter" in your configuration.

< H2 > attempted practice < / H2 >

tried to add (baseScanPackages= {"xxxxxx"}) to @ SpringBootApplication and still failed to achieve automatic injection.
in this case, there is no doubt that the example code is very concise. Is there something wrong with the example code, or is there something wrong with my understanding? Is there a solution? Thank you!

Mar.19,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e41007-44901.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e41007-44901.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?