Spring

Spring

org.springframework.data.mapping.PropertyReferenceException

코드 막 작성하다가 실패하면 안되는 contextLoads()가 실패해버린 모습... 마지막줄엔 Caused by: org.springframework.data.mapping.PropertyReferenceException at PropertyPath.java:90 라고 적혀있는데 구글링 해보니 스택오버플로우에서 Repository 관련 오류라고 함. 마침 임시로 만들어둔 Repository 가 있어서 확인해보니 밑줄 쳐져 있었다. 일단 주석처리... 성공!

Spring

스프링부트 3.0.0부터 Repository를 상속받는 PagingAndSortingRepository

책 읽던 중 PagingAndSortingRepository가 CrudRepository를 확장하는 역할을 한다는데 save메서드가 맛이 가버린 모습??? gpt에게 물어봐도 석연치 않은 답변만 내뱉어서 구글링 해본 결과 이게 정상인데 내 PagingAndSortingRepository를 들어가 본 결과 엥?????? 그냥 repository를 상속받아버린다.. 지금 진행중인 스프링부트 버전은 3.0.7인데 버전 2.7.8인 프로젝트로 들어가 보니 CrudRepository를 상속받고 있었다. 스프링 부트 버전 문제였던 것... 만약 정렬이 쓰고 싶으면 CrudRepository를 구현한 Repository 에다가 Iterable findAll(Sort sort); Page findAll(Pageable..

Spring

Crud 구현 중에 나타난 오류 고치기

1. 스프링 테스트 한 번에 실행 중 오류 Gradle에 내장된 test를 사용하였다! 테스트를 짠 모든 코드를 한 번에 실행시켜줘서 편하다. 근데.. 음 뭐 컨트롤러 테스트에 문제가 없는데 다시 테스트 해보니까 전부 터져버린 모습.. ??????????? 전부 오류명이 Failed to load ApplicationContext java.lang.IllegalStateException: Failed to load ApplicationContext 이고, 스프링부트 실행하다 중간에 끊 에러를 봤더니 No class com.example.crud.domain.Posts entity with id 1 exists! org.springframework.dao.EmptyResultDataAccessExcepti..

Spring

Cannot parse "TIMESTAMP" constant 에러

개발 환경: spring 2.7.11, java 11, h2 2.1.214 오류 메시지: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]: Invocation of init method failed; nested exception is org.springframework.jdbc.datasource.init.Sc..

Spring

스프링 REST Docs .snippet 확장자 해결

인강 듣던 중 request-fields.snippet 파일을 만들었는데 이 파일은 문서를 편집할 수 있게 만들어 준다. (예를 들면 content가 필수로 입력하는 것이 아닌 선택해서 입력하게 가능) 하지만 자바로 인식하는 모습.. https://docs.spring.io/spring-restdocs/docs/2.0.7.RELEASE/reference/html5/#configuration-uris-mockmvc:~:text=Spring%20REST%20Docs%20uses%20Mustache%20templates%20to%20produce%20the%20generated%20snippets. Spring REST Docs Document RESTful services by combining hand-w..

Spring

스프링부트 JPA Mysql 연동(java 17, Springboot 3.0.5)

강의에서 스프링 2.x.x버전과 자바 11, h2데이터베이스를 사용하는데 다르게 설정하다가 우여곡절이 많았다.. 세팅한 몇가지 부분을 서술하겠다. 1. 기본 세팅 os : Window 11 64bit 운영체제 https://start.spring.io/ Gradle-groovy, Java 17, 3.0.5 Dependencies : Spring Web, Spring data JPA, Thymeleaf, Lombok Mysql 다운하는법 버전 : mysql 8.0.32 2. Mysql Workbench 설정 CREATE DATABASE test_db; CREATE USER 'tester'@'localhost' identified BY 'test'; GRANT ALL PRIVILEGES ON test_db...

Spring

서버 포트 중복 해결법

Identify and stop the process that's listening on port 8080 or configure this application to listen on another port. 오류가 뜨면서 작동이 안 된다. cmd 열고 netstat -n -o -a 입력하면 현재 시스템에서 활성화된 네트워크 연결과 포트 상태를 보여준다. 이중 필요한 건 8080에 있는 PID인데 이 값을 기억했다가 taskkill /f /pid * ㄴ 별표 친 곳에 집어넣으면 된다. 다시 서버 켜면 성공!

상일동
'Spring' 카테고리의 글 목록