[IntelliJ] Live Template

๊น€์ •๋ฏผยท2022๋…„ 7์›” 22์ผ
1
post-thumbnail
post-custom-banner

Live Template

Live Template ์„ค์ •

  • Preference โ†’ Live Template ๋ฅผ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

Template ์†Œ์Šค

Controller

import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/$END$")
@Controller
@RequiredArgsConstructor
public class $METHOD_NAME$ {

  // TODO: DI ์ฃผ์ž… ๊ณต๊ฐ„
  // TODO: ex) private final NoticeService noticeService

  @GetMapping
  public ResponseEntity<?> get() {
    return new ResponseEntity<>(HttpStatus.OK);
  }

  @PostMapping
  public ResponseEntity<?> post() {
    return new ResponseEntity<>(HttpStatus.OK);
  }

  @PutMapping
  public ResponseEntity<?> put() {
    return new ResponseEntity<>(HttpStatus.OK);
  }

  @DeleteMapping
  public ResponseEntity<?> delete() {
    return new ResponseEntity<>(HttpStatus.OK);
  }
}

Serivce

import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class $METHOD_NAME$ implements $END${

  // TODO: DI ์ฃผ์ž… ๊ณต๊ฐ„ 
  // TODO: ex) private final NoticeRepository noticeRepository
  
}

Repository

import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;

@Repository
@RequiredArgsConstructor
public class $METHOD_NAME${
$END$
  // TODO: DI ์ฃผ์ž… ๊ณต๊ฐ„ 
  // TODO: ex) private final JPAQueryFactory jpaQueryFactory
  
}

Tdd

@org.junit.jupiter.api.Test
@org.junit.jupiter.api.DisplayName("$END$")
void $METHOD_NAME$() {
  // given
  
  // when

  // then
  org.assertj.core.api.Assertions.assertThat(1).isEqualTo(1);
}

METHOD_NAME ๋ณ€์ˆ˜ ์ •์˜

  • METHOD_NAME์„ fileNameWithoutExtension() ์œผ๋กœ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค.
  • Tdd์˜ ๋ณ€์ˆ˜ ์ •์˜๋Š” ClassName() ์œผ๋กœ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค.

  • Java์—์„œ ์‚ฌ์šฉ ํ•˜๋Š” ๊ฒƒ์œผ๋กœ ์„ค์ •์„ ํ•ฉ๋‹ˆ๋‹ค.

์‚ฌ์šฉ๋ฒ•

  • ์„ค์ •ํ•œ ๋‹จ์ถ•ํ‚ค๋ฅผ ์ž‘์„ฑํ•˜๊ณ  ์—”ํ„ฐ๋ฅผ ๋ˆŒ๋Ÿฌ์ฃผ๋ฉด ์ •์˜ํ–ˆ๋˜ Template์ด ์ž‘์„ฑ๋ฉ๋‹ˆ๋‹ค.

post-custom-banner

0๊ฐœ์˜ ๋Œ“๊ธ€