주석의 작동 원리를 설명하기 위해 이 문서에서는 endpoints-v2-backend 샘플을 빌드하기 위해 추가해야 하는 주석과 기타 코드를 endpoints-v2-skeleton 샘플로 보여줍니다. 결국 수정된 endpoints-v2-skeleton 샘플은 App Engine에서 Endpoints Frameworks 시작하기에서 사용된 endpoints-v2-backend 샘플과 동일하게 동작합니다.
코드 작성 및 주석 추가
코드에 주석을 추가하려면 다음 안내를 따르세요.
디렉터리를 프로젝트의 자바 소스 디렉터리로 변경합니다(예: src/main/java/com/example/skeleton).
다음과 같은 코드가 포함된 Message.java라는 JavaBean 클래스 파일을 만듭니다.
@ApiMethod는 백엔드 API의 일부인 클래스 메서드를 표시합니다 @ApiMethod로 표시되지 않은 메서드는 클라이언트 라이브러리와 검색 문서를 생성할 때 포함되지 않습니다. @ApiMethod 주석은 특정 메서드의 API 구성을 재정의할 때도 사용할 수 있습니다.
@Named는 매개변수가 항목 유형이 아닌 한, 서버 측 메서드로 전달되는 모든 매개변수에 추가되어야 합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-03-25(UTC)"],[[["\u003cp\u003eThis page guides you through structuring and annotating Cloud Endpoints Frameworks code, utilizing the \u003ccode\u003eendpoints-v2-skeleton\u003c/code\u003e sample project.\u003c/p\u003e\n"],["\u003cp\u003eThe document explains how to use annotations like \u003ccode\u003e@Api\u003c/code\u003e, \u003ccode\u003e@ApiMethod\u003c/code\u003e, and \u003ccode\u003e@Named\u003c/code\u003e to define and configure your backend API.\u003c/p\u003e\n"],["\u003cp\u003eYou'll learn how to modify the \u003ccode\u003eMyApi.java\u003c/code\u003e file by defining API versions and adding an \u003ccode\u003eecho\u003c/code\u003e method as your first API endpoint.\u003c/p\u003e\n"],["\u003cp\u003eThe document uses the \u003ccode\u003eendpoints-v2-backend\u003c/code\u003e sample as a reference, so the end result of modifying the \u003ccode\u003eendpoints-v2-skeleton\u003c/code\u003e will behave identically.\u003c/p\u003e\n"],["\u003cp\u003eBuilding the project will require you to use Maven or Gradle, depending on which system you use.\u003c/p\u003e\n"]]],[],null,[]]