반응형

2022/03 11

System.getProperty() 란?

Java에서 코드 작성 시 운영체제 정보나 현재 파일의 위치 등이 필요할 때 사용한다. System.getProperty() 안에 검색어를 입력하면 그 값이 String 타입으로 반환된다. ex) // 현재 디렉토리 위치 반환 String currentDir = System.getProperty("user.dir"); 첨부파일 업로드/다운로드 시 경로 설정에 사용할 수 있음 ()안에 들어갈 검색어로는 java.version , java.vendor , java.home , java.class.path , os.name , os.version , user.name , user.home , user.dir ...

Java 2022.03.30

[git] git statsh

내 로컬 저장소에서 코드를 수정 중인데 원격 저장소에 새로운 commit이 발생한 경우 pull을 하면 파일이 충돌하는 경우가 생긴다. 이때, 수정 중인 코드를 commit 할 수 없기 때문에 사용하는 것이 git stash 명령어이다. 이 명령어는 말그대로 commit 되지 않은 변경사항이 있는 파일들을 임시로 숨겨준다. git stash 하면 워킹 디렉토리가 HEAD 상태로 만들어준다. 그 후 git pull 로 당겨온다. - stash 의 임시 저장된 파일들 워킹 디렉토리에 적용 & statsh 에서 제거 git stash pop

git 2022.03.30

[Java] Java8 Stream 사용법

1. 생성 List list = Arrays.asList("a", "b", "c"); //방법1 Arrays.stream(list); //방법2 list.stream(); //방법3 Stream.of("a", "b", "c"); 2. 반환타입 - 중간연산 : return Stream; filter(), map(), flatmap(), distinct(), sort(), peek(), limit(), skip() .. - 최종연산 : return 특정한 type 3. collect collect()를 구현한 collectors의 정적 메서드 - toList(), toSet(), toCollection(), toMap() list.stream().collect(Collectors.toList()); list..

Java 2022.03.29

[Spring] 스프링부트 스케줄러 사용하기

1. @SpringBootApplication 이 선언된 패키지에 @EnableScheduling 애노테이션을 선언한다. * @EnableScheduling 은 @SpringBootApplication 이 선언된 패키지 또는 하위 패키지에 붙여야 함. @SpringBootApplication @EnableScheduling public class SchedulerApplication{ public static void main(String[] args){ SpringApplication.run(SchedulerApplication.class, args); } } 2. 스케줄러를 구현할 class에 @Component 애노테이션을 선언한다. 3. 스케줄러가 되는 메서드에 @Scheduled 애노테이션을 선..

스프링 2022.03.29

[Spring] application.properties 또는 application.yml 파일에 미리 값을 지정해둔 다음 사용하기

- application.yml ( application.properties ) 파일 my-host-id: xxx.xxx.xxxx schedule: /* 10분 간격으로 03분, 13분, 23분, 33분, 43분, 53분 실행 */ TestBatch: 0 3/10 * * * * ----------------------------------------------------------------- my-host-id=xxx.xxx.xxxx schedule.TestBatch=0 3/10 * * * * - 속성 값을 사용하는 class @Slf4j @RequiredArgsConstructor @Component public class TestBatch{ @Value("${my-host-id}") private ..

스프링 2022.03.29

[CSS] <div> 안의 <img> 크기 통일하는 방법 ( object-fit 속성, position : absolute)

1. object-fit 같은 object의 사이즈를 컨테이너의 크기에 맞춰서 조절할 수 있음 사용방법은 를 선택 후 object-fit : cover; 해주면 끝! img { width: 100%; height: 200px; object-fit: cover; } cover 가로, 세로 비율 유지, 비율이 맞지않아도 이미지를 화대하여 컨테이너 채움 contain 가로, 세로 비율 유지하여 컨테이너에 보여줌 fill 기본값 none 원본 이미지의 사이즈 유지 scale-down none 또는 contain 중 적절한 속성으로 조절함 2. position : absolute 의 부모 컨테이너에서 넘치는 부분을 자름 사용방법은 의 css를 position : absolute; 로 주고, 의 부모 에 overf..

카테고리 없음 2022.03.25

There is no getter for property named 'recordsPerPage' in 'class com.reviewer.portfolio.vo.paging.Criteria' 에러 해결 방법

이 에러는 mybatis 사용 시 쿼리가 작성되는 xml 파일에 #{} 부분의 변수명이 파라미터 타입의 필드명과 달라서 발생하는 에러이다. - PageVO @Component @Data @NoArgsConstructor public class PageVO { private int pageCnt; private int startPage; private int endPage; private int realEnd; private boolean prev, next; private int total; private Criteria criteria; ... } - .xml 파일 select id, category, title, url, file_id AS fileId, thumbnail_id AS thumbnail..

Mybatis 2022.03.24
반응형