thymeleaf-extras-springsecurity
thymeleaf-extras-springsecurity copied to clipboard
Currently only Spring 6.x or newer is supported - Bug report and workaround
I'm building a small Spring Boot v3.4.0 application with Spring 6.4.1, H2 v.2.3.232, Thymeleaf 3.1.2.RELEASE and thymeleaf-extras-springsecurity6 3.1.2.RELEASE. When I run the application from mvn spring-boot:run everything works. When I run it as a JAR file directly with Java, then everything except the page page with <em th:text="${#authentication.name}"> works.
When I visit that page I get the following stack trace:
org.thymeleaf.exceptions.ConfigurationException: The Spring-version-specific infrastructure could not create utility for the specific version of Spring being used. Currently only Spring 6.x or newer is supported.
at org.thymeleaf.extras.springsecurity6.util.SpringVersionSpecificUtils.<clinit>(SpringVersionSpecificUtils.java:74) ~[mobilereg-jar-with-dependencies.jar:0.0.5-SNAPSHOT]
at org.thymeleaf.extras.springsecurity6.dialect.expression.SpringSecurityExpressionObjectFactory.buildObject(SpringSecurityExpressionObjectFactory.java:90) ~[mobilereg-jar-with-dependencies.jar:0.0.5-SNAPSHOT]
at org.thymeleaf.DialectSetConfiguration$AggregateExpressionObjectFactory.buildObject(DialectSetConfiguration.java:785) ~[mobilereg-jar-with-dependencies.jar:0.0.5-SNAPSHOT]
at org.thymeleaf.expression.ExpressionObjects.getObject(ExpressionObjects.java:108) ~[mobilereg-jar-with-dependencies.jar:0.0.5-SNAPSHOT]
at org.thymeleaf.spring6.expression.ThymeleafEvaluationContext.lookupVariable(ThymeleafEvaluationContext.java:134) ~[mobilereg-jar-with-dependencies.jar:0.0.5-SNAPSHOT]
I noticed a peculiarity in the startup messages.
With mvn spring-boot:run it shows HHH000412: Hibernate ORM core version 6.6.2.Final.
When running as a JAR it shows HHH000412: Hibernate ORM core version 0.0.5-SNAPSHOT which is the version of my project in the pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>dk.datamuseum</groupId>
<artifactId>mobilereg</artifactId>
<name>mobilereg</name>
<version>0.0.5-SNAPSHOT</version>
When I change the version to 6.0.5-SNAPSHOT and compile, then running as a JAR, it works.
The message is now: HHH000412: Hibernate ORM core version 6.0.5-SNAPSHOT
Something in SpringVersionSpecificUtils.java is checking the wrong version number.