프로젝트/DevLink

[프로젝트] Naver Clova Speech 서비스에 적용 ( 2023.12.20(수) )

IT록흐 2023. 12. 21. 00:26
반응형

작업한 것

- Naver Speech API 샘플코드 분석 

- Speech 샘플코드에 커맨드 패턴, 팩토리 메소드 패턴 적용하여 멘토링 서비스에 적용하기

- 변환된 텍스트 DB에 저장하기 

 

배운 것

[ Git ERROR ]

error: Your local changes to the following files would be overwritten by checkout:
      00_topsection/css/meritz.css
Please commit your changes or stash them before you switch branches.
Aborting

커밋 되지 않은채 수정중인 파일이 있으면 pull이 일어나지 않는다. 모든 파일을 커밋하거나 커밋이 불안하면 stash 한 뒤 rebase 해야 한다. 

 

[ JAVA CODE ERROR ]

 

application.properties에서 값을 가져와 final로 선언된 배열에 동적으로 값을 넣고 싶은 경우, 생성자로 객체를 생성할때 값을 주입하면 된다. 선언할 때는 동적으로 값을 주입할 수 없다. 

 

// 틀린방법
private final Header[] headers = new Header[] {
            new BasicHeader("Accept", contentType),
            new BasicHeader("X-CLOVASPEECH-API-KEY", secret),
};

// 정답
public NaverSpeechConfigVo(String secret, String contentType, String invokeUrl, String fileUrl) {
    this.secret = secret;
    this.contentType = contentType;
    this.invokeUrl = invokeUrl;
    this.fileUrl = fileUrl;

    headers = new Header[] {
            new BasicHeader("Accept", contentType),
            new BasicHeader("X-CLOVASPEECH-API-KEY", secret),
    };
}

 

 

[ MySQL ERROR ]

com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Data too long for column 'record_content' at row 1

 

길이가 긴 문자열의 경우, Entity의 String 속성에 @Lob을 선언하면 CLOB 방식으로 저장된다. 

CLOB : String, char[]
BLOB : byte[]

 

마무리

백엔드 개발이 어느정도 마무리 되었다. 프론트엔드와 협업하며 부족한 부분 추가 개발을 진행해야 겠다.

반응형