본문 바로가기

반응형

Backend/Spring | SpringBoot

(51)
[Error Log] PropertyReferenceException, NoSuchBeanDefinitionException, UnsatisfiedDependencyException 로그를 살펴보니 contextLoads() FAILED가 발생 발원지는... 아마도 Caused by: org.springframework.data.mapping.PropertyReferenceException at PropertyPath.java:90 이 녀석으로 보인다. data.mapping과 구글링을 통해 db와 맵핑하는 부분에서 에러가 날것이라는 생각이듬. import com.together.MunDeuk.web.Board.entity.Board; import org.springframework.data.jpa.repository.JpaRepository; import java.util.List; public interface BoardRepository extends JpaRepository ..
[Spring] JPA 기본키 전략 기본키 전략에는 크게 두가지가 있다. 직접 할당과 자동생성하는 방법이 있다. 직접 할당하는 방법에는 @Id 어노테이션만을 적용하고 EntityManager.persist를 이용하면 된다. 하지만 자동생성하는 방법은 대리키를 사용하여 각각 전략에 따라 맞추어 자동 생성한다. 1. GenterationType.IDENTITY - 기본키 생성을 DB에 위임 - INSERT SQL후 DB에서 식별자를 조회 2. GenterationType.SEQUENCE - @SequenceGenerator 속성 - 맵핑 DLL create sequence [sequenceName] start with [initialValue] increment by [allocationSize] - e.g) @Entity @SequenceG..
application.yml 설정 org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'bean_name': Unsatisfied dependency expressed through field 'field'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bean_name': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not res..
Failed to load resource: the server responded with a status of 404 () Failed to load resource: the server responded with a status of 404 () 프로젝트에 WEB관련 코드나 파일이 존재 하는데도 못읽어 오는 경우에는 톰캣연결 확인 IntelliJ Community의 경우 Context path 경로를 확인 / IntelliJ Ultimate의 경우 Deployment\Application context 경로 확인
i18n i18n이란? - i18n은 Internationalization의 축약형임(가장 첫글자와 마지막글자 사이 18글자라서 i + 18 + n) cf1) SW국제화 : 국제적으로 통용되는 SW를 설계하고 개발 하는 것 cf2) SW현지화 : 현지(Locale)에 맞게 SW를 설계하고 개발 하는 것 i18n 용도 - 쿠키 값을 이용해 언어 정보를 받아와 처리 - 웹페이지의 국제화가 목적 - Spring의 MessageSource를 이용해 언어별 페이지 구현 Uncaught TypeError: $.i18n is not a function at Object.error (common.js:316:41) at c (jquery-3.6.0.min.js:2:28327) at Object.fireWith [as rejec..
Tomcat 에러 1. Failed to initialize connector [Connector[HTTP/1.1-포트번호]] 오류 org.apache.catalina.core.StandardService.initInternal Failed to initialize connector [Connector[HTTP/1.1-포트번호]] 보통은 지정한 포트가 충돌날때 일어나는 에러라고함 Sol) # cmd # 포트번호를 사용중인지 확인 가능 netstat -ano | findstr [포트번호] # 사용중이라면 사용중이 서비스를 종료하거나 포트번호를 변경해야 한다. # 서비스 종료 taskkill /f /pid 2. Tomcat 캐시 부족 경고 org.apache.catalina.webresources.Cache.getResour..
[Spring] 예외처리(Exception Handler)(2) java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens HTTPS가 아니라 HTTP프로토콜인데 HTTPS로 요청해서 에러 발생한것 Swagger에서 자동으로 HTTPS하는것을 풀거나 특정 Controller의 URL 프로토콜을 HTTP로 하는 방법을 찾아야 할것 같다. 예외처리 참고 블로그 : https://hyunminh.github.io/exception-handling/ Spring에서 예외 핸들링하기 도입 hyunminh.github.io package ncdc.cancermonitor.cmmn.exception; import java.util.Collecti..
[Spring] 예외처리(Exception Handler)(1) ErrorControll 가장 편한건 ResponseEntity로 처리 하는 방법 아직도 에러 메시지 처리에 대한 내용이 제대로 이해되지 않아 좀더 공부가 필요 일단 Controller에서만 독단적으로 처리하는 방법도 있지만 이렇게 하면 다른 컨트롤러에서는 사용이 불가능해서 객체지향적이지 못하다 private HashMap createErrorResponse(String errorMessage) { HashMap errorResponse = new HashMap(); errorResponse.put("errorCode", errorMessage); errorResponse.put("errorMsg", errorMessage); return errorResponse; } @RequestMapping(val..

반응형