목록분류 전체보기 (101)
기루 기룩 기록
보호되어 있는 글입니다.
Multi DB 환경에서 Transaction 어노테이션이 적용되지 않음 [원인] 멀티 DB 환경에선 각 DB별로 TransactionManager(매니저)가 생성되지만 어노테이션을 적용하며 매니저를 지정 하지 않을 경우 적용이 안되는것을 확인 [해결] 옵션 value를 사용해 매니저 지정 @Transactional(value = "secondTransactionManager")
DTO 인터페이스 public interface DTO { Y getInstanceByEntity(T t); T toEntity(); } DTO 구현체 @Getter @Setter public class NoticeDTO implements DTO { private Long pkey; private String title; private String content; private Long createdDt = new Date().toInstant().getEpochSecond(); // Instant public NoticeDTO() { } public NoticeDTO(Notice notice) { this.pkey = notice.getPkey(); this.title = notice.getTitle..
SPA를 사용하다보면 발생하는 새로고침 에러.. SPA는 모든 주소가 index.html을 향하게 돼있어 주소를 입력해 접속하거나, 새로고침을 하게되면 아래 첨부한 사진과 같이 404에러가 발생하게된다. 새로고침을 해도 해당 페이지로 이동을 하고싶다면 어떻게 해야될까? 방법은 간단하다. 앞서 말한 SPA의 특징인 모든 주소가 index.html을 향하게 된다는것을 이용하면 된다. 404 페이지는 error 페이지다. error가 발생하게 되면 index.html로 이동해주는 Controller를 만들면된다. spring boot의 내장 인터페이스인 ErrorController를 상속해 에러발생시 index.html로 이동시켜줄 controller를 구현하겠다. import org.springframewo..
설치 명령어 sudo apt install openjdk-8-jdk 설치 확인 java -version
@JsonInclude 어노데이션을 사용해 Response에 포함될 필드를 설정할 수 있다. Include.ALWAYES.. 등과 함께 사용한다. public static enum Include { ALWAYS, NON_NULL, NON_ABSENT, NON_EMPTY, NON_DEFAULT, CUSTOM, USE_DEFAULTS; private Include() { } } 예시 import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; @JsonInclude(Include.NON_NULL) public class CategoryResponseModel { pr..