간단한 스터디 프로젝트를 진행하던 도중 요런 엔티티를 정의했다. @Entity data class User( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) val id: Int?, val name: String, val password: String, val email: String, @CreationTimestamp val createdAt: Timestamp?, val role: String = Constants.ROLE_USER, ) { companion object { fun from(user: User): User = user.copy( password = PasswordEncoder.encode(user.password), ) } } 처음에..
Spring Boot 2에서 3으로 마이그레이션하는 경우, RestTemplate을 사용하기 위한 Apache HttpClient를 4 버전대신 5로 수정해주어야 하는 이슈로 인해 발생한다. build.gradle 등에 아래와 같은 implementation 구문을 추가하자. dependencies { implementation("org.apache.httpcomponents.client5:httpclient5:5.2.1") } 참고 Spring Boot 3.0 Migration Guide Spring Boot. Contribute to spring-projects/spring-boot development by creating an account on GitHub. github.com https://w..
Java 7에서 추가된 메소드이다. 첫 번째 인자로 받은 객체의 null 여부를 검사하여 다음과 같이 동작한다. null이 아닌 경우: 해당 객체를 그대로 반환한다. null인 경우: NPE를 발생시킨다. 두 번째 인자에 문자열을 입력하여 NPE의 메시지를 설정할 수 있다. public class Main { public static void main(String[] args) { String nullString = null; // String nullString = "null"; String checked = Objects.requireNonNull(nullString, "널이에용"); System.out.println(checked); } } 위 코드의 주석을 변경하면 checked는 null이라는 ..
public class Study { public static void main(String[] args) { for(Animals animal : Animals.values()) { animal.greeting(); animal.move(); } } } enum Animals { HUMAN(1.11) { @Override public void move() { System.out.println("move with human"); } }, BIRD(1, "Birdie"){ @Override public void move() { System.out.println("fly with bird"); } }, DOG(2, "Doggo"){ @Override public void move() { System.out...
JDK 1.5부터 추가된 개념이다. 부모 클래스의 메소드를 오버라이딩하는 경우, 부모 클래스의 반환 타입은 자식 클래스의 타입으로 변경이 가능하다. public class Main { public static void main(String[] args) { Parent parent = new Parent(); Child child = new Child(); Parent pc = new Child(); System.out.println(parent.createNewOne().getClass()); System.out.println(child.createNewOne().getClass()); System.out.println(pc.createNewOne().getClass()); } } class Paren..
Defining Methods (The Java™ Tutorials > Learning the Java Language > Classes and Objects) The Java Tutorials have been written for JDK 8. Examples and practices described in this page don't take advantage of improvements introduced in later releases and might use technology no longer available. See Java Language Changes for a summary of updated docs.oracle.com TL;DR 메소드 시그니쳐: 메소드명 + 매개변수 타입들 Def..
우리 프로젝트는 Spring Cloud Config Server를 먼저 실행한 후, Eureka 및 기타 서비스 App.을 실행시키는 식으로 동작한다. 때문에 Spring Cloud Config Client가 되는 Eureka 및 기타 서비스 App.은 설정 정보에 Config Server URI를 작성해야만 한다. 이 과정에서 궁금증이 생겼다. Spring Cloud Config의 정보 또한 Eureka로 관리할 수 있지 않을까? 결론부터 말하면, 가능했다. Config First Bootstrap과 Discovery First Bootstrap으로 나누어 아키텍처를 구성해볼 수 있으며, 이 때 각자 일장일단이 있어 원하는 형태를 선택하도록 되어 있다. 아래의 Hands-On은 Discovery Ser..
- Total
- Today
- Yesterday
- pgloader
- react
- terraform
- postgresql
- eureka
- dev
- 코딩테스트
- etc
- Git
- javascript
- AWS IoT
- AWS
- mysql
- Spring Cloud Config
- Linux
- JPA
- Gradle
- Vault
- IntelliJ
- hashicorp
- Puppeteer
- ffmpeg
- kotlin
- spring boot
- shell
- Docker
- jQuery
- Node.js
- Java
- Database
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |