인프런 커뮤니티 질문&답변
타임리프 식 기본 객체 표현식 오류 질문
해결된 질문
작성
·
3K
·
수정됨
0
[질문 템플릿]
1. 강의 내용과 관련된 질문인가요? (예)
2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예)
3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예)
[질문 내용]
안녕하세요 타임리프 - 기본기능 강의중 식 기본 객체 예제 실습 중 표현식 오류가 나서 질문 드립니다.
오류내용은 다음과 같습니다.
org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "#request" (template: "basic/basic-objects" - line 11, col 7)
at org.thymeleaf.spring6.expression.SPELVariableExpressionEvaluator.evaluate(SPELVariableExpressionEvaluator.java:292) ~[thymeleaf-spring6-3.1.0.RELEASE.jar:3.1.0.RELEASE]
...중략
Caused by: java.lang.IllegalArgumentException: The 'request','session','servletContext' and 'response' expression utility objects are no longer available by default for template expressions and their use is not recommended. In cases where they are really needed, they should be manually added as context variables.
at org.thymeleaf.standard.expression.StandardExpressionObjectFactory.buildObject(StandardExpressionObjectFactory.java:207) ~[thymeleaf-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.thymeleaf.spring6.expression.SpringStandardExpressionObjectFactory.buildObject(SpringStandardExpressionObjectFactory.java:110) ~[thymeleaf-spring6-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.thymeleaf.DialectSetConfiguration$AggregateExpressionObjectFactory.buildObject(DialectSetConfiguration.java:777) ~[thymeleaf-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.thymeleaf.expression.ExpressionObjects.getObject(ExpressionObjects.java:108) ~[thymeleaf-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.thymeleaf.spring6.expression.ThymeleafEvaluationContext.lookupVariable(ThymeleafEvaluationContext.java:134) ~[thymeleaf-spring6-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.expression.spel.ExpressionState.lookupVariable(ExpressionState.java:146) ~[spring-expression-6.0.2.jar:6.0.2]
at org.springframework.expression.spel.ast.VariableReference.getValueInternal(VariableReference.java:76) ~[spring-expression-6.0.2.jar:6.0.2]
at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:112) ~[spring-expression-6.0.2.jar:6.0.2]
at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:338) ~[spring-expression-6.0.2.jar:6.0.2]
at org.thymeleaf.spring6.expression.SPELVariableExpressionEvaluator.evaluate(SPELVariableExpressionEvaluator.java:265) ~[thymeleaf-spring6-3.1.0.RELEASE.jar:3.1.0.RELEASE]
... 58 common frames omitted
2022-12-08T22:59:02.658+09:00 ERROR 8488 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "#request" (template: "basic/basic-objects" - line 11, col 7)] with root cause
java.lang.IllegalArgumentException: The 'request','session','servletContext' and 'response' expression utility objects are no longer available by default for template expressions and their use is not recommended. In cases where they are really needed, they should be manually added as context variables.
at org.thymeleaf.standard.expression.StandardExpressionObjectFactory.buildObject(StandardExpressionObjectFactory.java:207) ~[thymeleaf-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.thymeleaf.spring6.expression.SpringStandardExpressionObjectFactory.buildObject(SpringStandardExpressionObjectFactory.java:110) ~[thymeleaf-spring6-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.thymeleaf.DialectSetConfiguration$AggregateExpressionObjectFactory.buildObject(DialectSetConfiguration.java:777) ~[thymeleaf-3.1.0.RELEASE.jar:3.1.0.RELEASE]
...중략해당 내용을 해석해보니 더이상 #request와 같은 표현식은 제공이 안되고 수동적으로 변수를 주입해서 사용하라는 것 같습니다. (modelAttribute로 request를 넘겨줘보니 출력이 잘되는걸 확인했습니다.) 혹시라도 제가 실수를 해서 표현식이 안되는 것인지 아니면 진짜로 더이상 이런 표현식을 제공하지 않는 것인지 궁금합니다.
항상 좋은 강의 감사합니다
답변 2
5
1
안녕하세요. Dahlia kim님, 공식 서포터즈 OMG입니다.
제가 3.0.0으로 실행했을 때도 동일한 오류가 발생하네요.
관련하여 해결 방안, 대체 방안등을 확인하고 답변드리겠습니다.
바로 학습진행이 필요하신 경우, 스프링부트 2.7.x로 진행해주세요.

감사합니다.





