Skip to content

Commit 0cb7a7d

Browse files
committed
Upgrade to Spring Boot 4.0.0-RC1
1 parent 1b04667 commit 0cb7a7d

21 files changed

+141
-110
lines changed

htmx-spring-boot-thymeleaf/pom.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</dependency>
2626
<dependency>
2727
<groupId>org.springframework.boot</groupId>
28-
<artifactId>spring-boot-starter-web</artifactId>
28+
<artifactId>spring-boot-starter-webmvc</artifactId>
2929
<optional>true</optional>
3030
</dependency>
3131
<dependency>
@@ -38,6 +38,11 @@
3838
<artifactId>spring-boot-starter-test</artifactId>
3939
<scope>test</scope>
4040
</dependency>
41+
<dependency>
42+
<groupId>org.springframework.boot</groupId>
43+
<artifactId>spring-boot-starter-webmvc-test</artifactId>
44+
<scope>test</scope>
45+
</dependency>
4146
</dependencies>
4247

4348
</project>

htmx-spring-boot-thymeleaf/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/thymeleaf/HtmxAttributeProcessor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package io.github.wimdeblauwe.htmx.spring.boot.thymeleaf;
22

3-
import com.fasterxml.jackson.core.JsonProcessingException;
4-
import com.fasterxml.jackson.databind.ObjectMapper;
53
import org.thymeleaf.context.ITemplateContext;
64
import org.thymeleaf.engine.AttributeDefinition;
75
import org.thymeleaf.engine.AttributeDefinitions;
@@ -16,6 +14,8 @@
1614
import org.thymeleaf.templatemode.TemplateMode;
1715
import org.thymeleaf.util.Validate;
1816
import org.unbescape.html.HtmlEscape;
17+
import tools.jackson.core.JacksonException;
18+
import tools.jackson.databind.ObjectMapper;
1919

2020
import java.util.LinkedHashMap;
2121

@@ -60,7 +60,7 @@ protected final void doProcess(
6060
if (expressionResult instanceof LinkedHashMap) {
6161
try {
6262
expressionResultString = this.mapper.writeValueAsString(expressionResult);
63-
} catch (JsonProcessingException e) {
63+
} catch (JacksonException e) {
6464
throw new TemplateProcessingException("Exception writing map", tag.getTemplateName(), tag.getLine(), tag.getLine(), e);
6565
}
6666
} else {

htmx-spring-boot-thymeleaf/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/thymeleaf/HtmxDialect.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package io.github.wimdeblauwe.htmx.spring.boot.thymeleaf;
22

3-
import com.fasterxml.jackson.databind.ObjectMapper;
43
import org.thymeleaf.dialect.AbstractProcessorDialect;
54
import org.thymeleaf.dialect.IExpressionObjectDialect;
65
import org.thymeleaf.expression.IExpressionObjectFactory;
76
import org.thymeleaf.processor.IProcessor;
7+
import tools.jackson.databind.ObjectMapper;
88

99
import java.util.HashSet;
1010
import java.util.Set;

htmx-spring-boot-thymeleaf/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/thymeleaf/HtmxThymeleafAutoConfiguration.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
package io.github.wimdeblauwe.htmx.spring.boot.thymeleaf;
22

3-
import com.fasterxml.jackson.databind.ObjectMapper;
4-
import com.fasterxml.jackson.databind.json.JsonMapper;
53
import org.springframework.boot.autoconfigure.AutoConfiguration;
64
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
75
import org.springframework.context.annotation.Bean;
6+
import tools.jackson.databind.json.JsonMapper;
87

98
@AutoConfiguration
109
@ConditionalOnWebApplication
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
io.github.wimdeblauwe.htmx.spring.boot.thymeleaf.HtmxThymeleafAutoConfiguration

htmx-spring-boot-thymeleaf/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/thymeleaf/HtmxDialectTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import org.junit.jupiter.api.Test;
55
import org.springframework.beans.factory.annotation.Autowired;
6-
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
6+
import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest;
77
import org.springframework.test.context.ContextConfiguration;
88
import org.springframework.test.web.servlet.MockMvc;
99

htmx-spring-boot/pom.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</dependency>
2121
<dependency>
2222
<groupId>org.springframework.boot</groupId>
23-
<artifactId>spring-boot-starter-web</artifactId>
23+
<artifactId>spring-boot-starter-webmvc</artifactId>
2424
<optional>true</optional>
2525
</dependency>
2626
<dependency>
@@ -33,6 +33,11 @@
3333
<artifactId>spring-boot-starter-test</artifactId>
3434
<scope>test</scope>
3535
</dependency>
36+
<dependency>
37+
<groupId>org.springframework.boot</groupId>
38+
<artifactId>spring-boot-starter-webmvc-test</artifactId>
39+
<scope>test</scope>
40+
</dependency>
3641
<dependency>
3742
<groupId>org.springframework.security</groupId>
3843
<artifactId>spring-security-test</artifactId>
@@ -43,16 +48,11 @@
4348
<artifactId>spring-boot-starter-thymeleaf</artifactId>
4449
<scope>test</scope>
4550
</dependency>
46-
<dependency>
47-
<groupId>io.rest-assured</groupId>
48-
<artifactId>rest-assured</artifactId>
49-
<scope>test</scope>
50-
</dependency>
5151
<dependency>
5252
<groupId>com.google.code.findbugs</groupId>
5353
<artifactId>jsr305</artifactId>
54-
<optional>true</optional>
5554
<version>3.0.2</version>
55+
<optional>true</optional>
5656
</dependency>
5757
</dependencies>
5858

htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxHandlerInterceptor.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
import org.springframework.web.servlet.HandlerInterceptor;
88
import org.springframework.web.servlet.ModelAndView;
99

10-
import java.lang.reflect.Method;
11-
1210
/**
1311
* HandlerInterceptor that adds htmx specific headers to the response.
1412
*/

htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxHandlerMethodHandler.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
package io.github.wimdeblauwe.htmx.spring.boot.mvc;
22

3-
import com.fasterxml.jackson.core.JsonProcessingException;
4-
import com.fasterxml.jackson.databind.ObjectMapper;
53
import jakarta.servlet.http.HttpServletRequest;
64
import jakarta.servlet.http.HttpServletResponse;
75
import org.springframework.core.annotation.AnnotatedElementUtils;
8-
import org.springframework.http.HttpHeaders;
6+
import tools.jackson.core.JacksonException;
7+
import tools.jackson.databind.ObjectMapper;
98

109
import java.lang.reflect.Method;
1110
import java.time.Duration;
@@ -211,7 +210,7 @@ private String getRequestUrl(HttpServletRequest request) {
211210
private void setHeaderJsonValue(HttpServletResponse response, HtmxResponseHeader header, Object value) {
212211
try {
213212
response.setHeader(header.getValue(), objectMapper.writeValueAsString(value));
214-
} catch (JsonProcessingException e) {
213+
} catch (JacksonException e) {
215214
throw new IllegalArgumentException("Unable to set header " + header.getValue() + " to " + value, e);
216215
}
217216
}

htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxLocationRedirectView.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package io.github.wimdeblauwe.htmx.spring.boot.mvc;
22

3-
import com.fasterxml.jackson.core.JsonProcessingException;
4-
import com.fasterxml.jackson.databind.json.JsonMapper;
53
import jakarta.servlet.http.HttpServletRequest;
64
import jakarta.servlet.http.HttpServletResponse;
75
import org.springframework.web.servlet.view.RedirectView;
6+
import tools.jackson.core.JacksonException;
7+
import tools.jackson.databind.json.JsonMapper;
88

99
import java.io.IOException;
1010
import java.util.Map;
@@ -172,7 +172,7 @@ private HtmxLocation createLocation(String url) {
172172
private void setHeaderAsJson(HttpServletResponse response, String name, Object value) {
173173
try {
174174
response.setHeader(name, jsonMapper.writeValueAsString(value));
175-
} catch (JsonProcessingException e) {
175+
} catch (JacksonException e) {
176176
throw new IllegalArgumentException("Unable to set header " + name + " to " + value, e);
177177
}
178178
}

0 commit comments

Comments
 (0)