クラスが見つからなかったタイプの豆「はjava.lang.String型」を必要と

Arthurofos:

私は春にmailserviceとしてみてください。私は春ブーツバージョン2.1.7.ReleaseとAmazon SQS--javaのメッセージング-libのバージョン1.0.8を使用しています。

以下のように私のコードのルックス:

    @Service
@RequiredArgsConstructor
public class MailService {

private static final Logger logger = Logger.getLogger(MailService.class.getName());
private final AmazonSQS amazonSQS;

@Value("${aws.sqs.queue.mail}")
private final String sqsQueueMail;

public void sendMail(final SQSMailParams mailParams) {

    final String queueUrl = amazonSQS.getQueueUrl(sqsQueueMail).getQueueUrl();

    try {
        final String messageBody = SQSMailParams.createSQSMailParams(mailParams, mailParams.getTemplateKey(), mailParams.getProcessId()).toJson();
        final SendMessageRequest sendMessageRequest = new SendMessageRequest(queueUrl, messageBody);
        sendMessageRequest.setMessageGroupId("TOLL-BOX-MAIL");

        amazonSQS.sendMessage(sendMessageRequest);
        logger.info("TOLL-BOX mail added to mail queue");
    } catch (JsonProcessingException e) {
        logger.error("Mail cannot be added to the mail queue: " + String.join(",", mailParams.recipients) + "." + e);
    }

    }
}

しかし、私は、コードを実行することによって、次の失敗を取得します。

2020-03-02 07:34:00.242 ERROR 10568 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

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

Description:

Parameter 1 of constructor in de.svg.tollbox.service.MailService required a bean of type 'java.lang.String' that could not be found.


Action:

Consider defining a bean of type 'java.lang.String' in your configuration.

Disconnected from the target VM, address: '127.0.0.1:43565', transport: 'socket'

Process finished with exit code 1

誰かが間違っているあなたに感謝イム何を教えてもらえ。

サーウ:

削除finalからsqsQueueMail

@Value("${aws.sqs.queue.mail}")
private String sqsQueueMail;

それはあなたの問題を解決する必要があります。どういうわけか、と@RequiredArgsConstructor@Value変数のための注釈は種類の豆を探すためにアプリケーションを作っている解決されませんString

おすすめ

転載: http://43.154.161.224:23101/article/api/json?id=19308&siteId=1