1. @ModelAttribute- 요청 파라미터를 특정 객체에 바인딩 할 때 사용된다.- 주로 DTO나 데이터 클래스를 받아서 요청 데이터를 객체로 변환하는데 사용한다.DTO를 매개변수로 받는 예시 ▼//--------------------Controller----------------------------@GetMapping("/user")fun getUser(@ModelAttribute request: UserRequest): String { return "Hello, ${request.name}"}//----------------------------------------------------------//-------------------DTO class-----------------------..
ThrowableThe base class for all errors and exceptions. Only instances of this class can be thrown or caught.매개변수- message : the detail message string.- cause : the cause of this throwable. ExceptionThe class Exception and its subclasses are a form of Throwable that indicates conditions that a reasonable application might want to catch. The class Exception and any subclasses that are not also sub..
Gradle은 Spring을 사용하지 않는 일반적인 Kotlin 프로젝트에서도 사용할 수 있다.프로젝트에 Gradle을 적용하고 org.mapstruct.Mapper를 사용하려면 아래 절차를 따르면 된다.1. Gradle 설정 파일 추가- Gradle이 없는 프로젝트라면 gradle 디렉터리 및 build.gradle.kts 파일을 생성해야 한다.- build.gradle.kts 파일이 없다면 프로젝트 루트에 생성한다.2. Gradle Kotlin 프로젝트로 설정build.gradle.kts에 다음 내용을 추가한다.plugins { kotlin("jvm") version "1.9.0" // 코틀린 버전에 맞게 변경}repositories { mavenCentral()}dependencies {..
javax validation : https://javaee.github.io/javaee-spec/javadocs/javax/validation/constraints/package-summary.html?utm_source=chatgpt.comNotBlankThe annotated element must not be null and must contain at least one non-whitespace character. Accepts CharSequence.NotNullThe annotated element must not be null. Accepts any type.NotEmptyThe annotated element must not be null nor empty. Supported types..
출처 Java의 직렬화어떤 객체(class)를 byte로 변환하는 것Java의 역직렬화직렬화한 Byte를 다시 객체(Class)로 변환하여 JVM 메모리에 들고 있는 것 직렬화란?각 언어의 코드를 하위 레벨의 문자열로 변환하는 것이라고 에둘러 얘기할 수 있을 것이다. 직렬화가 필요한 이유Java객체를 Byte로 변환한 뒤 파일 형태로 저장하고, 다른 시스템에서 가져와 사용할 수 있게 된다.JVM과 독립적으로 무언가를 저장하고 싶을 때 사용된다. 직렬화 예제import java.io.Serializable;public class HelloSerialize implements Serializable {}import java.io.ByteArrayOutputStream;import java.io.IOExcep..
잭슨이란공식 문서를 번역했습니다. https://github.com/FasterXML/jackson잭슨 릴리즈 페이지 https://github.com/FasterXML/jackson/wiki/Jackson-Releases잭슨은 Java Json Library로 알려져있습니다. 자바를 위한 Json parser입니다.잭슨은 자바와 JVM을 위한 data-processing tool로도 적합합니다. 포조와 Json을 위한 데이터 바인딩으로도 좋습니다.잭슨의 1.x 버전은 deprecated됐고 2.x 버전이 계속 개발 중에 있습니다. 이 둘은 서로 다른 자바 패키지에 속해 있고 서로 호환 가능하며 양립이 가능합니다. (한 프로젝트에서 잭슨 1.x와 2.x를 충돌 없이 사용 가능합니다.) 1.x 버전에서 2..