분류 전체보기 645

[Bootstrap] 부트스트랩의 아이콘 사용하기

https://icons.getbootstrap.com/ Bootstrap Icons Official open source SVG icon library for Bootstrap icons.getbootstrap.com 여기에서 다양한 아이콘을 사용할 수 있다. 예시) 위의 말풍선 아이콘을 사용해보겠다. 1. head 태그에 위의 링크를 추가(그래야 아이콘이 뜬다.) Comments 2. Icon front를 클래스에 다음과 같이 추가했다. 🎶 결과 참고 👇 https://velog.io/@saichoiblog/how-to-use-bootstrap-icon 부트스트랩 아이콘 활용하는 방법 부트스트랩 아이콘을 사용하여 이벤트 넣는 방법 velog.io

FE/html 2022.06.02

[Error] Caused by: java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'post' available as request attribute

There was an unexpected error (type=Internal Server Error, status=500). An error happened during template parsing (template: "class path resource [templates/post/createPostForm.html]") org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: "class path resource [templates/post/createPostForm.html]") Caused by: org.attoparser.ParseException: Error dur..

DTO

✨ DTO Data Transfer Object 계층간에 데이터를 전송할 때 사용한다. Contoller와 View, Controller와 Service DTO를 사용하는 이유 내부 데이터 구조를 유출하지 않는다. 유지보수가 쉬워진다. DTO를 사용하는 흐름 View에서 Contoller로부터 DTO를 받는다. Contoller에서 Service로 DTO를 보낸다. Service에서 Entity를 Controller에 보낸다. Controller에서 Entity를 DTO로 변환하고, model에 담아 View로 보낸다. DTO ➡️ Entity 또는 Entity ➡️ DTO로 변환하기 [첫 번째 방법] ModelMapper 사용 ModelMapper를 사용하면 자동으로 해줘서 편하다. [두 번째 방법] ..

[ERROR] org.springframework.security.authentication.InternalAuthenticationServiceException

org.springframework.security.authentication.InternalAuthenticationServiceException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: The server time zone value '���ѹα� ǥ�ؽ�' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the 'serverTimezone' configuration property) to use a more specific time zone value ..

Languages/SQL 2022.05.23

@JoinColumn

@ManyToOne //@JoinColumn(name="id") @JoinColumn private Post post; @ManyToOne //@JoinColumn(name="id") @JoinColumn private User user; Comment 엔티티에 다음과 같이 조인을 했다. 댓글 엔티티 Comment는 게시글 엔티티 Post와 N:1관계 게시글 하나에 댓글을 여러 개 작성할 수 있다. 댓글 엔티티 Comment는 사용자 엔티티 User와 N:1 관계 한 사용자가 댓글을 여러 개 작성할 수 있다. @JoinColumn의 속성 name은 매핑할 외래 키 이름을 지정 기본값은 필드명 + _ + 참조하는 테이블의 기본 키 컬럼명 위의 경우는 post_id, user_id로 지정된다. 참고 👉 자바..

ORM/JPA 2022.05.19

변경 감지(Dirty Checking)

Entity를 수정할 때 데이터만 변경하면 된다. Entity의 변경사항을 데이터베이스에 자동으로 반영하는 기능을 Dirty Checking Dirty Checking은 영속성 컨텍스트가 관리하는 영속 상태의 Entity에만 적용됨 Entity의 모든 필드를 업데이트한다. 🤔 어떻게 Dirty Checking이 이루어질까? JPA는 Entity를 영속성 컨텍스트에 보관할 때, 최초의 상태를 복사해서 저장해둔다. 이를 '스냅샷'이라고 부른다. 플러시 시점에 스냅샷과 Entity를 비교해서 변경된 Entity를 찾는다. '플러시(flush)'는 영속성 컨텍스트의 변경 내용을 데이터베이스에 반영하는 것 ✨ Dirty Checking 적용 예시 public void update(String title, Stri..

ORM/JPA 2022.05.18

Docker Compose

Compose file구성versionservices실행할 컨테이너들을 정의image컨테이너를 생성할 때 사용할 이미지build도커파일로부터 이미지를 빌드contextDockerfile이 있는 위치environment환경 변수 설정command컨테이너가 실행될 때 수행할 명령어depends_on명시된 컨테이너가 먼저 생성되고 실행ports개방할 포트 지정expose링크로 연계된 컨테이너에게만 공개할 포트 설정volumes컨테이너에 볼륨 마운트restart컨테이너가 종료될 때 재시작하는 방법no재시작 xalways항상 재시작on-failure오류가 있을 때 재시작networkvolumeconfigsecret  Compose file 예시version: '3'services: spring-boot: ..

DevOps/Docker 2022.05.05

변경된 소스 코드 바로 적용하기

서버 실행 중에 코드를 변경하면 바로 반영함(f5키 누르기) 1. dependencies { developmentOnly 'org.springframework.boot:spring-boot-devtools' } build.gradle에 SpringBoot DevTools 의존성 추가 2. File -> Settings -> Advanced Settings > Allow auto-make to start even if developed application is currently running 체크 참고 👇 https://kim-oriental.tistory.com/8 IntelliJ(인텔리제이) Spring Boot DevTools 적용 안녕하세요, 오리엔탈 킴입니다. IntelliJ(인텔리제이) Spr..

IDE/Intellij 2022.05.05

Build

gradlew.bat clean build 폴더 삭제 gradlew.bat build 빌드 cd build/libs 최상위 루트에서 jar 파일이 있는 곳으로 이동 java -jar .jar jar 파일 실행 아래는 예시 java -jar Bulletin-Board-0.0.1-SNAPSHOT.jar 참고 👇 https://dev-coco.tistory.com/68 [Spring Boot] Gradle jar 빌드 및 배포하기 Spring Boot에는 내장 서버가 있어 실행 가능한 jar 파일을 만들어 배포하기가 쉽습니다. Spring Boot + Gradle 프로젝트를 생성하면 기본 jar 를 배포할 수 있도록 설정이 되어있습니다. jar를 빌드하는 방 dev-coco.tistory.com

JAVA 2022.04.29