분류 전체보기 645

redirect

클라이언트가 서버로 요청함 서버가 다른 URL로 리다이렉트함 클라이언트가 바뀐 URL로 다시 서버에 요청 👇 참고 https://webstone.tistory.com/65 리다이렉트란(Redirect) HTTP 리다이렉트(Redirect)란? 리다이렉트란 말 그대로 re(다시) + 지시하다(direct) 다시 지시하는 것을 말한다. 예를 들어 브라우저가 www.webstone.com/blogA URL을 웹 서버에 요청했다고 하.. webstone.tistory.com

디버깅 속도가 느려졌을 때

ctrl-shift-f8을 누르면 모든 Breakpoints를 관리할 수 있는 창이 뜬다. 필요 없는 지점은 체크 해제하자. 👇 참고 https://developer0513.tistory.com/166 intellij-idea 디버깅 속도가 느리거나 디버깅 모드로 진입이 되지 않을때. 어제 업무가 바빠서( 솔직히 이야기하면 퍼포먼스가 안나서) 어쩔수 없이 야근하는 상황에 담당자는 쪼고 있고 작성한 코드를 확인할려고 shift-f9로 디버깅 모드로 진입할려고 하는데 디버깅 모 developer0513.tistory.com

IDE/Intellij 2022.02.08

[Error] form 전송시 서버에 null이 들어온다

✨ 해결 name="userId"여서 null이 들어왔다. 필드 네임 "username"으로 고침 password는 iloveyou00!,iloveyou00!로 들어가서 한 번만 들어가게 했다. form 전송시 null이 전송되면 name 속성을 살펴보자. 그리고 disabled가 있는 태그는 form 전송이 안 된다. 유저 아이디를 disabled로 해서 null이 들어왔던 것이다. readonly를 사용하면 사용자가 값을 수정할 수 없고, form 전송은 된다. 👇 참고 https://south10.tistory.com/66 input 태그 form 전송시 disabled와 readonly 차이 input 태그 form 전송시 disabled와 readonly 차이 form submit 전송시에 di..

FE/html 2022.02.08

@RequestParam | @PathVariable | @RequestBody | @ModelAttribute

@RequestParam 사용 예시 @PostMapping("/user/phoneCheck") // 전화번호 중복 검사 @ResponseBody public boolean phoneCheck(@RequestParam("phone") String phone){ LOG.info("userPhoneCheck 진입"); LOG.info("전달받은 번호:"+phone); boolean flag=userService.userPhoneCheck(phone); LOG.info("확인 결과:"+flag); return flag; } /user/phoneCheck?phone=01012345678 프런트엔드에서 name과 RequestParam 변수명이 같아야 함 @RequestParam Map params Map 타입으로..

[CSS] div 태그로 사각형 그리기

.my-box{ border : 1px solid; padding : 30px; background-color: #f5f5f5; width : 400px; } class명이 my-box인 div 태그에 스타일을 줬다. solid는 선 padding은 안쪽 여백 background-color는 사각형을 채우는 색 참고 👇 http://mwultong.blogspot.com/2006/06/html-css-div-box.html [HTML-CSS] DIV 태그로 간단한 박스(Box) 그리기 예제 div 태그에, 가령 이런 스타일을 적용해 주어야 합니다: border:1px solid; 박스를 그리기 위해서는, border 속성으로 테두리를 만들어 주면 됩니다. 위의 예에서, 굵기는 1픽셀로 지정되어 있고 so..

FE/html 2022.02.07

HEAD detached

checkout을 한후 HEAD detached가 뜬다. HEAD detached는 HEAD가 직접 커밋을 가리키는 것 평상시에는 HEAD는 브랜치를 가리킨다. 다른 브랜치로 checkout하면 HEAD detached 상태에서 생성한 커밋은 사라진다. 🐝 해결 1. 브랜치 생성 git checkout -b 새로운브랜치명 2. master 브랜치로 이동 git checkout master 3. 새로운 브랜치와 master를 병합 git merge 새로운브랜치명 4. 새로운 브랜치 삭제(선택사항) git branch -d 브랜치명 5. 이전 커밋으로 전환 git checkout {커밋아이디} 다시 최신 커밋으로 돌아가려면 브랜치명을 적는다. ex) git checkout develop은 develop 브랜..

git 2022.02.06

개인정보 수정

@GetMapping("/user/form") // 개인정보 수정 public String updateForm(Model model){ Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); String id=authentication.getName(); // 로그인한 유저 id model.addAttribute("user", userService.findByUsername(id).get()); return "/user/updateForm"; } 유저 아이디를 이용해서 객체를 찾아 model에 담았다. 개인정보수정 개인정보수정 버튼은 사용자가 로그인했을 때 보인다. 참고 👇 https://flyburi...

@DataJpaTest와 @SpringBootTest

@DataJpaTest @SpringBootTest JPA 테스트와 연관된 config만 적용 full application config를 로드 자동으로 롤백 수동 롤백 in-memory DB를 이용해 테스트 @Component 빈은 @SpringBootTest를 쓰자. 참고 👇 https://krksap.tistory.com/1013 @SpringBootTest와 @DataJpaTest 차이점 @SpringBootTest와 @DataJpaTest 차이점 Spring Application(스프링 어플리케이션)은 ApplicationContext이다. 스프링의 기본 컨셉이 ApplicationContext에 Bean(Object)들을 미리 로드 해놓고 사용하는 컨셉이기.. krksap.tistory.com..

JUnit5

h2 데이터베이스로 테스트할 때 application.properties에서 아래와 같이 변경(수정해야 하는 부분만 가져옴) Mockito를 사용하면 DB 안 거치니까 필요없다. spring.datasource.url=jdbc:h2:tcp://localhost/~/test spring.datasource.driver-class-name=org.h2.Driver JUnit 5는 Architecture Jupiter, Vintage, JUnit Platform로 나뉘어 진다. Jupiter와 Vintage 모두 JUnit Platform을 구현하는 구현체 Jupiter는 JUnit 5의 구현체 @Autowired를 선언하면 Jupiter가 Spring Container에게 빈 주입을 요청 어노테이션 @Bef..

Test/Junit 2022.01.27

[Error] The given id must not be null!; nested exception is java.lang.IllegalArgumentException: The given id must not be null!

@Test public void joinUser(){ //given User user1=new User(); user1.setUsername("spring00"); user1.setEmail("abc@naver.com"); user1.setEnabled(true); user1.setName("스프링"); user1.setPassword("lovespring00!"); user1.setPhone("01012345678"); user1.setRoles(new ArrayList()); // when userService.joinUser(user1); // then User findUser=userRepository.findById(user1.getId()).get();// 에러가 발생한 부분 assertTha..