A Java record is a restricted Java class for declaring compact immutable data-carrier types. In a Spring AI REST application, Question carries the submitted question and Answer carries the generated answer; each currently contains one String property and can gain more properties as the application evolves. section 1.1.2
Request and response records
public record Question(String question) { }\npublic record Answer(String answer) { }\n\nThe service reads the submitted value with question.question() and wraps the generated text with new Answer(answerText). section 1.1.2
package com.example.boardgamebuddy;
public record Question(String question) {
}
Inspect the compact Question declaration used as the REST service input. section 1.1.2



