본문 바로가기 메뉴 바로가기

Studying programming

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

Studying programming

검색하기 폼
  • Jimin's Programming (194)
    • Algorithms (54)
    • JavaScript (16)
    • Vue.js (3)
    • Node.js (3)
    • React.js (7)
    • React Native (0)
    • Spring Boot (13)
    • JAVA (58)
    • C++ (17)
    • Programming (19)
    • Computer basics (4)
  • 방명록

Spring Boot (13)
@Builder annotation

@Builder annotation이 builder pattern을 대신 생성해준다.다수의 field를 가지는 경우에 builder를 사용하는 경우가 많다.builder pattern 이 생성에 필수인자와 선택인자를 구분해준다. (생성과 표현의 분리가 이루어 질 수 있다.)객체 생성의 방식이다다른 class에서의 사용은 피하고 constructor에 이용한다.

Spring Boot 2019. 3. 22. 16:31
DTO 의 @Data와 @Setter

@Getter @NoArgsConstructor @AllArgsConstructor public class TravelDto { @NotEmpty @Column(name = "startDate") private String startDate; @NotEmpty @Column(name = "endDate") private String endDate; @NotEmpty @Column(name = "country") private String country; @NotEmpty @Column(name = "city") private int city; @Column(name = "NumOfPeople") private String NumOfPeople; @Column(name = "age") private Str..

Spring Boot 2019. 3. 18. 05:31
Injecting beans using constructor

There are two different way to inject spring beans using @Autowired and Constructor. When it comes to using a constructor to inject a bean, Lombok is a useful way to reduce some boilerplate code. However, if fields order within a method is changed, parameters order also would be changed, so that error would occur. You can use the constructor instead of @Autowired to prevent the error. @Autowired..

Spring Boot 2019. 3. 17. 06:52
Id type은 왜 Long 일까

Primitive type long으로 id를 생성하면 NullPointerException 이 불가하기 때문에 id는 Long type으로 선언해줘야한다.

Spring Boot 2019. 3. 10. 05:42
DTO(Data Transfer Object) 와 ModelMapper

DTO 와 ModealMapper 는 왜 사용되는 걸까? DTO(Data Transfer Object)는 DB Table에서 숨기고 싶은 정보가 있을 때 (예로 User의 Id)그 정보들은 제외하고 나머지 Column들만 따로 빼내서 객체 전송을 위해 만든 Object이다. 이렇게되면 다른 사용자는 중요한 정보에 접근할 수가 없게된다. 그러나 이렇게 했을때 DTO는 Database Table이 아니기 때문에 Database 와의 연결을 해줘야하는대 그때 사용되는 것이 ModelMapper 이다. ModelMapper 를 이용해 DB Table 과 DTO를 계속 convert할 수 있게된다. ModelMapper 사용예제 main에서 bean을 먼저주입 import org.modelmapper.ModelM..

Spring Boot 2019. 3. 10. 02:34
Constructor Injection

When a bean has a single constructor, @Autowired annotation is no longer needed. Use 'final' to make sure that object is not changed after it's initialized However, for Setter injection, you need @Autowired. private final UsersRepository usersRepository; private final ModelMapper modelMapper; //@Autowired public UsersController(UsersRepository usersRepository, ModelMapper modelMapper){ this.user..

Spring Boot 2019. 3. 8. 04:42
이전 1 2 3 다음
이전 다음
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
  • Javascript Algorithm
  • java
  • rest parameter
  • ... in Javascript
  • C++
  • substring()
  • equals()
  • Collection Framework
  • hackerrank
  • math.abs
  • algorithm
  • easy javascript algorithm
  • hackerrank javascript solution
  • HackerRank Algorithm
  • easy algorithm
  • 프로그래머스
  • hackerrank solution
  • Object type casting
  • 알고리즘
  • code refactoring
  • spring boot application
  • 프로그래머스 알고리즘문제
  • hackerrank javascript
  • javascript
  • HashMap
  • repeat()
  • math.max
  • compareTo()
  • 프로그래머스 알고리즘
  • string class in java
more
«   2025/07   »
일 월 화 수 목 금 토
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
글 보관함

Blog is powered by Tistory / Designed by Tistory

티스토리툴바