본문 바로가기

Server Oriented/Spring

Spring import 패키지 (Annotation)

org.springframework.stereotype._____

@Controller

@Service

 

 

 

org.springframework.web.bind.annotation._____

@RestController

@RequestMapping,

@GetMapping

@PostMapping,

@PutMapping

@PatchMapping

@DeleteMapping

@PathVariable

@RequestBody

@ResponseBody

 

 

 

org.springframework.ui._____

Model

 

 

 

org.springframework.beans.factory.annotation._____

@Autowired

 

 

 

org.springframework.data.jpa.repository._____

Repository ← CrudRepository ← ListCrudRepository ← JpaRepository

Repository ← PagingAndSortingRepository ← ListPagingAndSortingRepository ← JpaRepository

@Query (JPQL)

/resources/META-INF/orm.xml 참조

 

 

 

org.springframework.transaction.annotation._____

@Transactional (jakarta.transaction.Transactional 도 가능하지만 스프링 호환)

 

 

 

org.springframework.http._____

@ResponseEntity (@ResponseBody 보다 세세한 설정이 필요한 경우 HttpStatus 와 함께 사용)

HttpStatus

 

 

 

jakarta.persistence._____

@Entity

@Id

@Column

@GeneratedValue (strategy = GenerationType.)

@ManyToOne (다대일, 여러개가 하나와 연결, 즉.. Foreign Key 라는 얘기)

@OneToMany (일대다, 하나가 여러개와 연결, 즉.. Primary Key 라는 얘기)

@JoinColumn(name="fk_칼럼명") (@ManyToOne 등등에 병기)

 

 

 

com.fasterxml.jackson.annotation.___

@JsonProperty

 

 

 

lombok._____

@NoArgsConstructor

@AllArgsConstructor

@Getter

@Setter

@ToString

@Data (@Getter, @Setter, @ToString 등을 대체)

 

 

lombok.extern.slf4j._____

@Slf4j

 

 

 

org.junit.jupiter.api._____

@Test

@DisplayName

 

 

 

java.lang._____

@IllegalArgumentException

 

 

 

org.springframework.boot.test.context._____

@SpringBootTest

 

 

 

org.springframework.boot.test.autoconfigure.orm.jpa._____

@DataJpaTest