• Spring boot + Thymeleaf + IntelliJ
  • 개발 툴에서 실행시 정상 작동하나 jar로 실행시 index 페이지만 진입되고 다른 페이지는 뷰단을 못찾음
  • application.yml에는 Thymeleaf 설정하지 않음
  • view path: /member/custom-login

template might not exist or might not be accessible by any of the configured Template Resolvers

18:46:38.954 [http-nio-8080-exec-10] ERROR org.thymeleaf.TemplateEngine - [THYMELEAF][http-nio-8080-exec-10] Exception processing template "/member/custom-login": Error resolving template [/member/custom-login], template might not e
xist or might not be accessible by any of the configured Template Resolvers
org.thymeleaf.exceptions.TemplateInputException: Error resolving template [/member/custom-login], template might not exist or might not be accessible by any of the configured Template Resolvers
        at org.thymeleaf.engine.TemplateManager.resolveTemplate(TemplateManager.java:869) ~[thymeleaf-3.0.15.RELEASE.jar!/:3.0.15.RELEASE]
        at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:607) ~[thymeleaf-3.0.15.RELEASE.jar!/:3.0.15.RELEASE]

 

 

spring:
  thymeleaf:
    prefix: classpath:/templates/

 

spring.thymeleaf:prefix: classpath:/templates/ 옵션을 추가하였으나 효과가 없었음 

경로에 슬래시(/)가 중복으로 들어가면 에러가 발생 한다고 한다.

리턴 패스를 "/member/custom-login"에서 "member/custom-login"로 변경하자 정상 작동하였다.

 

spring.thymeleaf:prefix: classpath:/templates <- 여기서 슬래시를 지워도 작동 되지만

해당 옵션 디폴트 값이 classpath:/templates/라서 패스에서 슬래시를 빼는 쪽으로 가기로 했다.

 

 

 

## 참고글

 

https://bigphu.tistory.com/94

 

[Spring Boot/Thymeleaf] Exception processing template

스프링 부트로 프로젝트 작업중에 파싱에러가 발생했다. ide 사용시에는 정상이었으나 운영배포 때문에 jar package 테스트를 위하여 cmd 창에서 java -jar 로 실행하니 에러가 발생하였다. 총 두가지

bigphu.tistory.com

https://docs.spring.io/spring-boot/docs/current/reference/html/application-properties.html#application-properties.templating.spring.thymeleaf.enabled

 

Common Application Properties

 

docs.spring.io

 

테스트 코드를 실행하니 @DisplayName의 한글 인코딩이 깨진다.

 

설정 > 에디터 > 파일 인코딩

에기서 인코딩 부분을 전부 UTF-8로 변경.

프로퍼티 파일 부분에서 명확한 Native에서 ASCll로의 변환 체크

 

{intelliJ}/bin/idea64.exe.vmoptions 파일에

-Dfile.encoding=UTF-8 < 항목 추가

 

도움말 > 사용자 지정 VM 옵션 편집

-Dfile.encoding=UTF-8 < 항목 추가

 

유닛 테스트 결과 DisplayName이 한글로 정상적으로 노출됨.

 

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: 

Error creating bean with name 'adminConnection' defined in class path resource [applicationContext.xml]: 

Invocation of init method failed; nested exception is java.lang.NullPointerException

 

 

 

자바파일 생성시 인터페이스 추가로 EnvironmentAware 추가시, 변수명이 자동적으로 environment로 정해진다.

setEnv의 변수명과 자동생성변수명이 달라서 생긴 에러

 

 

 

수정하니 잘 됩니다

 

 

불러오는 중입니다...

 

 

+ Recent posts