diff --git a/README.md b/README.md
index 689cd897..695ac66d 100644
--- a/README.md
+++ b/README.md
@@ -4,18 +4,33 @@
# Spring Boot and Thymeleaf library for htmx
-This library provides helper classes and a [Thymeleaf](https://www.thymeleaf.org/) dialect
+This project provides annotations, helper classes and a [Thymeleaf](https://www.thymeleaf.org/) dialect
to make it easy to work with [htmx](https://htmx.org/)
in a [Spring Boot](https://spring.io/projects/spring-boot) application.
More information about htmx can be viewed on [their website](https://htmx.org/).
-## Installation
+## Maven configuration
-The library is available
+The project provides the following libraries, which are available
on [Maven Central](https://mvnrepository.com/artifact/io.github.wimdeblauwe/htmx-spring-boot-thymeleaf),
-so it is easy to add the dependency to your project.
+so it is easy to add the desired dependency to your project.
+### htmx-spring-boot
+
+Provides annotations and helper classes.
+
+```xml
+
+ io.github.wimdeblauwe
+ htmx-spring-boot
+ LATEST_VERSION_HERE
+
+```
+
+### htmx-spring-boot-thymeleaf
+
+Provides a [Thymeleaf](https://www.thymeleaf.org/) dialect to easily work with htmx attributes.
```xml
io.github.wimdeblauwe
@@ -28,7 +43,7 @@ so it is easy to add the dependency to your project.
### Configuration
-The included Spring Boot autoconfiguration will enable the htmx integrations.
+The included Spring Boot Auto-configuration will enable the htmx integrations.
### Request Headers
@@ -88,13 +103,67 @@ public String hxUpdateUser(){
}
```
-### Processors
+### OOB Swap support
+
+htmx supports updating multiple targets by returning multiple partials in a single response with
+[`hx-swap-oob`](https://htmx.org/docs/#oob_swaps). Return partials using this library use the `HtmxResponse` as a return
+type:
+
+```java
+@GetMapping("/partials/main-and-partial")
+public HtmxResponse getMainAndPartial(Model model){
+ model.addAttribute("userCount", 5);
+ return new HtmxResponse()
+ .addTemplate("users :: list")
+ .addTemplate("users :: count");
+}
+```
+
+An `HtmxResponse` can be formed from view names, as above, or fully resolved `View` instances, if the controller knows how
+to do that, or from `ModelAndView` instances (resolved or unresolved). For example:
+
+```java
+@GetMapping("/partials/main-and-partial")
+public HtmxResponse getMainAndPartial(Model model){
+ return new HtmxResponse()
+ .addTemplate(new ModelAndView("users :: list")
+ .addTemplate(new ModelAndView("users :: count", Map.of("userCount",5));
+}
+```
+
+Using `ModelAndView` means that each fragment can have its own model (which is merged with the controller model before rendering).
+
+### Spring Security
+
+The library has an `HxRefreshHeaderAuthenticationEntryPoint` that you can use to have htmx force a full page browser
+refresh in case there is an authentication failure.
+If you don't use this, then your login page might be appearing in place of a swap you want to do somewhere.
+See [htmx-authentication-error-handling](https://www.wimdeblauwe.com/blog/2022/10/04/htmx-authentication-error-handling/)
+blog post for detailed information.
+
+To use it, add it to your security configuration like this:
+
+```java
+@Bean
+public SecurityFilterChain filterChain(HttpSecurity http)throws Exception{
+ // probably some other configurations here
+
+ var entryPoint = new HxRefreshHeaderAuthenticationEntryPoint();
+ var requestMatcher = new RequestHeaderRequestMatcher("HX-Request");
+ http.exceptionHandling(exception ->
+ exception.defaultAuthenticationEntryPointFor(entryPoint, requestMatcher));
+ return http.build();
+}
+```
+
+### Thymeleaf
_See [Attribute Reference](https://htmx.org/reference/#attributes) for the related htmx documentation._
-Thymeleaf processors are provided to allow Thymeleaf to be able to perform calculations and expressions
+The Thymeleaf dialect has appropriate processors that enable Thymeleaf to perform calculations and expressions
in htmx-related attributes.
-Note the `:` colon instead of the typical hyphen.
+
+>**Note** The `:` colon instead of the typical hyphen.
- `hx:get`: This is a Thymeleaf processing enabled attribute
- `hx-get`: This is just a static attribute if you don't need the Thymeleaf processing
@@ -108,18 +177,17 @@ For example, this Thymeleaf template:
Will be rendered as:
```html
-
Load user details
```
-The included Thymeleaf dialect has corresponding processors for most of the `hx-*` attributes.
+The Thymeleaf dialect has corresponding processors for most of the `hx-*` attributes.
Please [open an issue](https://github.com/wimdeblauwe/htmx-spring-boot-thymeleaf/issues) if something is missing.
> **Note**
> Be careful about using `#` in the value. If you do `hx:target="#mydiv"`, then this will not work as Thymeleaf uses
> the `#` symbol for translation keys. Either use `hx-target="#mydiv"` or `hx:target="${'#mydiv'}"`
-### Map support for hx:vals
+#### Map support for hx:vals
The [hx-vals](https://htmx.org/attributes/hx-vals/) attribute allows to add to the parameters that will be submitted
with the AJAX request. The value of the attribute should be a JSON string.
@@ -129,74 +197,17 @@ The library makes it a bit easier to write such a JSON string by adding support
For example, this Thymeleaf expression:
```html
-
```
will render as:
```html
-
```
(Given `user.id` has the value `1234`)
-### OOB Swap support
-
-htmx supports updating multiple targets by returning multiple partial response with
-[`hx-swap-oob`](https://htmx.org/docs/#oob_swaps). Return partials using this library use the `HtmxResponse` as a return
-type:
-
-```java
-@GetMapping("/partials/main-and-partial")
-public HtmxResponse getMainAndPartial(Model model){
- model.addAttribute("userCount",5);
- return new HtmxResponse()
- .addTemplate("users :: list")
- .addTemplate("users :: count");
- }
-```
-
-An `HtmxResponse` can be formed from view names, as above, or fully resolved `View` instances, if the controller knows how
-to do that, or from `ModelAndView` instances (resolved or unresolved). For example:
-
-```java
-@GetMapping("/partials/main-and-partial")
-public HtmxResponse getMainAndPartial(Model model){
- return new HtmxResponse()
- .addTemplate(new ModelAndView("users :: list")
- .addTemplate(new ModelAndView("users :: count", Map.of("userCount",5));
- }
-```
-
-Using `ModelAndView` means that each fragment can have its own model (which is merged with the controller model before rendering).
-
-### Spring Security
-
-The library has an `HxRefreshHeaderAuthenticationEntryPoint` that you can use to have htmx force a full page browser
-refresh in case there is an authentication failure.
-If you don't use this, then your login page might be appearing in place of a swap you want to do somewhere.
-See [htmx-authentication-error-handling](https://www.wimdeblauwe.com/blog/2022/10/04/htmx-authentication-error-handling/)
-blog post for detailed information.
-
-To use it, add it to your security configuration like this:
-
-```java
- @Bean
-public SecurityFilterChain filterChain(HttpSecurity http)throws Exception{
- // probably some other configurations here
- http...
-
- var entryPoint=new HxRefreshHeaderAuthenticationEntryPoint();
- var requestMatcher=new RequestHeaderRequestMatcher("HX-Request");
- http.exceptionHandling(exception->
- exception.defaultAuthenticationEntryPointFor(entryPoint,
- requestMatcher));
- return http.build();
- }
-```
-
## Articles
Links to articles and blog posts about this library:
@@ -209,7 +220,8 @@ Links to articles and blog posts about this library:
| htmx-spring-boot-thymeleaf | Spring Boot | Minimum Java version |
|---------------------------------------------------------------------------------------|-------------|----------------------|
-| [2.2.0](https://github.com/wimdeblauwe/htmx-spring-boot-thymeleaf/releases/tag/2.2.0) | 3.x. | 17 |
+| [3.0.0](https://github.com/wimdeblauwe/htmx-spring-boot-thymeleaf/releases/tag/2.1.0) | 3.1.x | 17 |
+| [2.2.0](https://github.com/wimdeblauwe/htmx-spring-boot-thymeleaf/releases/tag/2.2.0) | 3.0.x | 17 |
| [1.0.0](https://github.com/wimdeblauwe/htmx-spring-boot-thymeleaf/releases/tag/1.0.0) | 2.7.x | 11 |
## Contributing
@@ -228,7 +240,7 @@ To release a new version of the project, follow these steps:
1. Update `pom.xml` with the new version and commit
2. Tag the commit with the version (e.g. `1.0.0`) and push the tag.
-3. Create a new release in GitHub via https://github.com/wimdeblauwe/htmx-spring-boot-thymeleaf/releases/new
+3. Create a new release in GitHub via https://github.com/wimdeblauwe/htmx-spring-boot/releases/new
- Select the newly pushed tag
- Update the release notes. This should automatically start
the [release action](https://github.com/wimdeblauwe/htmx-spring-boot-thymeleaf/actions).
diff --git a/htmx-spring-boot-thymeleaf/pom.xml b/htmx-spring-boot-thymeleaf/pom.xml
new file mode 100644
index 00000000..7640a118
--- /dev/null
+++ b/htmx-spring-boot-thymeleaf/pom.xml
@@ -0,0 +1,59 @@
+
+
+ 4.0.0
+
+
+ io.github.wimdeblauwe
+ htmx-spring-boot-parent
+ 3.0.0-SNAPSHOT
+
+
+ io.github.wimdeblauwe
+ htmx-spring-boot-thymeleaf
+ Spring Boot library for htmx and Thymeleaf
+ Spring Boot library to make it easy to work with htmx and Thymeleaf
+
+
+
+ io.github.wimdeblauwe
+ htmx-spring-boot
+ ${parent.version}
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+ org.springframework.boot
+ spring-boot-configuration-processor
+ true
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+ true
+
+
+ org.springframework.boot
+ spring-boot-starter-thymeleaf
+ true
+
+
+ org.springframework.boot
+ spring-boot-starter-security
+ true
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.springframework.security
+ spring-security-test
+ test
+
+
+
+
diff --git a/src/main/java/io/github/wimdeblauwe/hsbt/thymeleaf/HtmxAttributeProcessor.java b/htmx-spring-boot-thymeleaf/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/thymeleaf/HtmxAttributeProcessor.java
similarity index 98%
rename from src/main/java/io/github/wimdeblauwe/hsbt/thymeleaf/HtmxAttributeProcessor.java
rename to htmx-spring-boot-thymeleaf/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/thymeleaf/HtmxAttributeProcessor.java
index fca99b6b..3d6046fd 100644
--- a/src/main/java/io/github/wimdeblauwe/hsbt/thymeleaf/HtmxAttributeProcessor.java
+++ b/htmx-spring-boot-thymeleaf/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/thymeleaf/HtmxAttributeProcessor.java
@@ -1,4 +1,4 @@
-package io.github.wimdeblauwe.hsbt.thymeleaf;
+package io.github.wimdeblauwe.htmx.spring.boot.thymeleaf;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
diff --git a/src/main/java/io/github/wimdeblauwe/hsbt/thymeleaf/HtmxDialect.java b/htmx-spring-boot-thymeleaf/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/thymeleaf/HtmxDialect.java
similarity index 96%
rename from src/main/java/io/github/wimdeblauwe/hsbt/thymeleaf/HtmxDialect.java
rename to htmx-spring-boot-thymeleaf/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/thymeleaf/HtmxDialect.java
index 71f1153e..1291724a 100644
--- a/src/main/java/io/github/wimdeblauwe/hsbt/thymeleaf/HtmxDialect.java
+++ b/htmx-spring-boot-thymeleaf/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/thymeleaf/HtmxDialect.java
@@ -1,7 +1,6 @@
-package io.github.wimdeblauwe.hsbt.thymeleaf;
+package io.github.wimdeblauwe.htmx.spring.boot.thymeleaf;
import com.fasterxml.jackson.databind.ObjectMapper;
-import io.github.wimdeblauwe.hsbt.mvc.HtmxSpringStandardExressionObjectFactory;
import org.thymeleaf.dialect.AbstractProcessorDialect;
import org.thymeleaf.dialect.IExpressionObjectDialect;
import org.thymeleaf.expression.IExpressionObjectFactory;
diff --git a/src/main/java/io/github/wimdeblauwe/hsbt/thymeleaf/HtmxExpressionObjectFactory.java b/htmx-spring-boot-thymeleaf/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/thymeleaf/HtmxExpressionObjectFactory.java
similarity index 92%
rename from src/main/java/io/github/wimdeblauwe/hsbt/thymeleaf/HtmxExpressionObjectFactory.java
rename to htmx-spring-boot-thymeleaf/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/thymeleaf/HtmxExpressionObjectFactory.java
index c612319f..a2976db4 100644
--- a/src/main/java/io/github/wimdeblauwe/hsbt/thymeleaf/HtmxExpressionObjectFactory.java
+++ b/htmx-spring-boot-thymeleaf/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/thymeleaf/HtmxExpressionObjectFactory.java
@@ -1,6 +1,6 @@
-package io.github.wimdeblauwe.hsbt.thymeleaf;
+package io.github.wimdeblauwe.htmx.spring.boot.thymeleaf;
-import io.github.wimdeblauwe.hsbt.mvc.HtmxHandlerMethodArgumentResolver;
+import io.github.wimdeblauwe.htmx.spring.boot.mvc.HtmxHandlerMethodArgumentResolver;
import jakarta.servlet.http.HttpServletRequest;
import org.thymeleaf.context.IExpressionContext;
import org.thymeleaf.context.IWebContext;
diff --git a/src/main/java/io/github/wimdeblauwe/hsbt/thymeleaf/HtmxThymeleafConfiguration.java b/htmx-spring-boot-thymeleaf/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/thymeleaf/HtmxThymeleafAutoConfiguration.java
similarity index 80%
rename from src/main/java/io/github/wimdeblauwe/hsbt/thymeleaf/HtmxThymeleafConfiguration.java
rename to htmx-spring-boot-thymeleaf/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/thymeleaf/HtmxThymeleafAutoConfiguration.java
index 3972759d..eacf5602 100644
--- a/src/main/java/io/github/wimdeblauwe/hsbt/thymeleaf/HtmxThymeleafConfiguration.java
+++ b/htmx-spring-boot-thymeleaf/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/thymeleaf/HtmxThymeleafAutoConfiguration.java
@@ -1,4 +1,4 @@
-package io.github.wimdeblauwe.hsbt.thymeleaf;
+package io.github.wimdeblauwe.htmx.spring.boot.thymeleaf;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.boot.autoconfigure.AutoConfiguration;
@@ -7,7 +7,7 @@
@AutoConfiguration
@ConditionalOnWebApplication
-public class HtmxThymeleafConfiguration {
+public class HtmxThymeleafAutoConfiguration {
@Bean
public HtmxDialect htmxDialect(ObjectMapper mapper) {
return new HtmxDialect(mapper);
diff --git a/htmx-spring-boot-thymeleaf/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/htmx-spring-boot-thymeleaf/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 00000000..eebb64ba
--- /dev/null
+++ b/htmx-spring-boot-thymeleaf/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+io.github.wimdeblauwe.htmx.spring.boot.thymeleaf.HtmxThymeleafAutoConfiguration
diff --git a/src/test/java/io/github/wimdeblauwe/hsbt/DummyApplication.java b/htmx-spring-boot-thymeleaf/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/thymeleaf/DummyApplication.java
similarity index 56%
rename from src/test/java/io/github/wimdeblauwe/hsbt/DummyApplication.java
rename to htmx-spring-boot-thymeleaf/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/thymeleaf/DummyApplication.java
index f31dad70..70ba3066 100644
--- a/src/test/java/io/github/wimdeblauwe/hsbt/DummyApplication.java
+++ b/htmx-spring-boot-thymeleaf/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/thymeleaf/DummyApplication.java
@@ -1,24 +1,17 @@
-package io.github.wimdeblauwe.hsbt;
+package io.github.wimdeblauwe.htmx.spring.boot.thymeleaf;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
-import org.springframework.context.annotation.Bean;
-
-import io.github.wimdeblauwe.hsbt.mvc.PartialsController.TodoRepository;
/**
* Just created this here to make Spring Boot test slices work
*/
-@SpringBootApplication(exclude = {SecurityAutoConfiguration.class}) // Security is on by default
+@SpringBootApplication(exclude = SecurityAutoConfiguration.class) // Security is on by default
public class DummyApplication {
public static void main(String[] args) {
SpringApplication.run(DummyApplication.class);
}
- @Bean
- TodoRepository repository() {
- return () -> 2;
- }
}
diff --git a/src/test/java/io/github/wimdeblauwe/hsbt/thymeleaf/HtmxDialectTest.java b/htmx-spring-boot-thymeleaf/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/thymeleaf/HtmxDialectTest.java
similarity index 87%
rename from src/test/java/io/github/wimdeblauwe/hsbt/thymeleaf/HtmxDialectTest.java
rename to htmx-spring-boot-thymeleaf/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/thymeleaf/HtmxDialectTest.java
index 211ecc76..311137fd 100644
--- a/src/test/java/io/github/wimdeblauwe/hsbt/thymeleaf/HtmxDialectTest.java
+++ b/htmx-spring-boot-thymeleaf/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/thymeleaf/HtmxDialectTest.java
@@ -1,4 +1,4 @@
-package io.github.wimdeblauwe.hsbt.thymeleaf;
+package io.github.wimdeblauwe.htmx.spring.boot.thymeleaf;
import org.junit.jupiter.api.Test;
@@ -10,6 +10,7 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.xpath;
@WebMvcTest(HtmxDialectTestController.class)
@WithMockUser
@@ -126,8 +127,7 @@ void testWithHxVals() throws Exception {
assertThat(html)
.containsPattern("hx-vals-div-boolean.*hx-vals=\"\\{"someBooleanProperty":true}\"")
.containsPattern("hx-vals-div-string.*hx-vals=\"\\{"someStringProperty":"someString"}\"")
- .containsPattern("hx-vals-div-number.*hx-vals=\"\\{"someNumberProperty":12345}\"")
- ;
+ .containsPattern("hx-vals-div-number.*hx-vals=\"\\{"someNumberProperty":12345}\"");
}
@Test
@@ -137,4 +137,20 @@ void testHxValidate() throws Exception {
.andReturn().getResponse().getContentAsString();
assertThat(html).containsPattern("hx-validate-div.*hx-validate=\"true\"");
}
+
+ @Test
+ public void testHtmxRequestExpressionObject() throws Exception {
+ mockMvc.perform(get("/htmx-dialect-expression-object-factory")
+ .header("HX-Request", "true"))
+ .andExpect(status().isOk())
+ .andExpect(xpath("//div[@id='htmxRequest']").exists());
+ }
+
+ @Test
+ public void testHtmxRequestExpressionObjectWorkEvenWhenNotHtmxRequest() throws Exception {
+ mockMvc.perform(get("/htmx-dialect-expression-object-factory")) // No HX-Request header
+ .andExpect(status().isOk())
+ .andExpect(xpath("//div[@id='htmxRequest']").doesNotExist());
+ }
+
}
diff --git a/src/test/java/io/github/wimdeblauwe/hsbt/thymeleaf/HtmxDialectTestController.java b/htmx-spring-boot-thymeleaf/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/thymeleaf/HtmxDialectTestController.java
similarity index 65%
rename from src/test/java/io/github/wimdeblauwe/hsbt/thymeleaf/HtmxDialectTestController.java
rename to htmx-spring-boot-thymeleaf/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/thymeleaf/HtmxDialectTestController.java
index e31e211e..fa9191c5 100644
--- a/src/test/java/io/github/wimdeblauwe/hsbt/thymeleaf/HtmxDialectTestController.java
+++ b/htmx-spring-boot-thymeleaf/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/thymeleaf/HtmxDialectTestController.java
@@ -1,22 +1,26 @@
-package io.github.wimdeblauwe.hsbt.thymeleaf;
+package io.github.wimdeblauwe.htmx.spring.boot.thymeleaf;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;
@Controller
-@RequestMapping("/htmx-dialect")
public class HtmxDialectTestController {
- @GetMapping
+
+ @GetMapping("/htmx-dialect")
public String htmxDialect(Model model) {
model.addAttribute("trueVariable", true);
model.addAttribute("falseVariable", false);
model.addAttribute("listVariable", List.of(1, 2, 3));
model.addAttribute("stringVariable", "someString");
model.addAttribute("numberVariable", 12345);
- return "htmx-dialect-test";
+ return "htmx-dialect";
+ }
+
+ @GetMapping("/htmx-dialect-expression-object-factory")
+ public String expressionObjectFactory() {
+ return "htmx-dialect-expression-object-factory";
}
}
diff --git a/htmx-spring-boot-thymeleaf/src/test/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc.imports b/htmx-spring-boot-thymeleaf/src/test/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc.imports
new file mode 100644
index 00000000..4fbd08b5
--- /dev/null
+++ b/htmx-spring-boot-thymeleaf/src/test/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc.imports
@@ -0,0 +1,2 @@
+io.github.wimdeblauwe.htmx.spring.boot.mvc.HtmxMvcAutoConfiguration
+io.github.wimdeblauwe.htmx.spring.boot.thymeleaf.HtmxThymeleafAutoConfiguration
diff --git a/src/test/resources/templates/htmxRequest.html b/htmx-spring-boot-thymeleaf/src/test/resources/templates/htmx-dialect-expression-object-factory.html
similarity index 87%
rename from src/test/resources/templates/htmxRequest.html
rename to htmx-spring-boot-thymeleaf/src/test/resources/templates/htmx-dialect-expression-object-factory.html
index 02bede8d..1e92c6bc 100644
--- a/src/test/resources/templates/htmxRequest.html
+++ b/htmx-spring-boot-thymeleaf/src/test/resources/templates/htmx-dialect-expression-object-factory.html
@@ -4,7 +4,7 @@
htmx request
-
+
It is an htmx Request
diff --git a/src/test/resources/templates/htmx-dialect-test.html b/htmx-spring-boot-thymeleaf/src/test/resources/templates/htmx-dialect.html
similarity index 100%
rename from src/test/resources/templates/htmx-dialect-test.html
rename to htmx-spring-boot-thymeleaf/src/test/resources/templates/htmx-dialect.html
diff --git a/htmx-spring-boot/pom.xml b/htmx-spring-boot/pom.xml
new file mode 100644
index 00000000..00add1a4
--- /dev/null
+++ b/htmx-spring-boot/pom.xml
@@ -0,0 +1,54 @@
+
+
+ 4.0.0
+
+
+ io.github.wimdeblauwe
+ htmx-spring-boot-parent
+ 3.0.0-SNAPSHOT
+
+
+ io.github.wimdeblauwe
+ htmx-spring-boot
+ Spring Boot library for htmx
+ Spring Boot library to make it easy to work with htmx
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+ org.springframework.boot
+ spring-boot-configuration-processor
+ true
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+ true
+
+
+ org.springframework.boot
+ spring-boot-starter-security
+ true
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.springframework.security
+ spring-security-test
+ test
+
+
+ org.springframework.boot
+ spring-boot-starter-thymeleaf
+ test
+
+
+
+
diff --git a/src/main/java/io/github/wimdeblauwe/hsbt/mvc/HtmxHandlerInterceptor.java b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxHandlerInterceptor.java
similarity index 81%
rename from src/main/java/io/github/wimdeblauwe/hsbt/mvc/HtmxHandlerInterceptor.java
rename to htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxHandlerInterceptor.java
index 73974113..97355bd8 100644
--- a/src/main/java/io/github/wimdeblauwe/hsbt/mvc/HtmxHandlerInterceptor.java
+++ b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxHandlerInterceptor.java
@@ -1,9 +1,9 @@
-package io.github.wimdeblauwe.hsbt.mvc;
+package io.github.wimdeblauwe.htmx.spring.boot.mvc;
-import static io.github.wimdeblauwe.hsbt.mvc.HtmxResponseHeader.HX_REFRESH;
-import static io.github.wimdeblauwe.hsbt.mvc.HtmxResponseHeader.HX_TRIGGER;
-import static io.github.wimdeblauwe.hsbt.mvc.HtmxResponseHeader.HX_TRIGGER_AFTER_SETTLE;
-import static io.github.wimdeblauwe.hsbt.mvc.HtmxResponseHeader.HX_TRIGGER_AFTER_SWAP;
+import static io.github.wimdeblauwe.htmx.spring.boot.mvc.HtmxResponseHeader.HX_REFRESH;
+import static io.github.wimdeblauwe.htmx.spring.boot.mvc.HtmxResponseHeader.HX_TRIGGER;
+import static io.github.wimdeblauwe.htmx.spring.boot.mvc.HtmxResponseHeader.HX_TRIGGER_AFTER_SETTLE;
+import static io.github.wimdeblauwe.htmx.spring.boot.mvc.HtmxResponseHeader.HX_TRIGGER_AFTER_SWAP;
import java.lang.reflect.Method;
diff --git a/src/main/java/io/github/wimdeblauwe/hsbt/mvc/HtmxHandlerMethodArgumentResolver.java b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxHandlerMethodArgumentResolver.java
similarity index 95%
rename from src/main/java/io/github/wimdeblauwe/hsbt/mvc/HtmxHandlerMethodArgumentResolver.java
rename to htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxHandlerMethodArgumentResolver.java
index da7ad718..8332b765 100644
--- a/src/main/java/io/github/wimdeblauwe/hsbt/mvc/HtmxHandlerMethodArgumentResolver.java
+++ b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxHandlerMethodArgumentResolver.java
@@ -1,4 +1,4 @@
-package io.github.wimdeblauwe.hsbt.mvc;
+package io.github.wimdeblauwe.htmx.spring.boot.mvc;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.core.MethodParameter;
@@ -9,7 +9,7 @@
import java.util.Objects;
-import static io.github.wimdeblauwe.hsbt.mvc.HtmxRequestHeader.*;
+import static io.github.wimdeblauwe.htmx.spring.boot.mvc.HtmxRequestHeader.*;
public class HtmxHandlerMethodArgumentResolver implements HandlerMethodArgumentResolver {
@Override
diff --git a/src/main/java/io/github/wimdeblauwe/hsbt/mvc/HtmxMvcConfiguration.java b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxMvcAutoConfiguration.java
similarity index 86%
rename from src/main/java/io/github/wimdeblauwe/hsbt/mvc/HtmxMvcConfiguration.java
rename to htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxMvcAutoConfiguration.java
index 25aad269..1cb4cd56 100644
--- a/src/main/java/io/github/wimdeblauwe/hsbt/mvc/HtmxMvcConfiguration.java
+++ b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxMvcAutoConfiguration.java
@@ -1,4 +1,4 @@
-package io.github.wimdeblauwe.hsbt.mvc;
+package io.github.wimdeblauwe.htmx.spring.boot.mvc;
import java.util.List;
@@ -19,13 +19,13 @@
@AutoConfiguration
@ConditionalOnWebApplication
-public class HtmxMvcConfiguration implements WebMvcRegistrations, WebMvcConfigurer {
+public class HtmxMvcAutoConfiguration implements WebMvcRegistrations, WebMvcConfigurer {
private final ObjectFactory resolver;
private final ObjectFactory locales;
private final ObjectMapper objectMapper;
- HtmxMvcConfiguration(@Qualifier("viewResolver") ObjectFactory resolver, ObjectFactory locales, ObjectMapper objectMapper) {
+ HtmxMvcAutoConfiguration(@Qualifier("viewResolver") ObjectFactory resolver, ObjectFactory locales, ObjectMapper objectMapper) {
Assert.notNull(resolver, "ViewResolver must not be null!");
Assert.notNull(locales, "LocaleResolver must not be null!");
diff --git a/src/main/java/io/github/wimdeblauwe/hsbt/mvc/HtmxRequest.java b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxRequest.java
similarity index 98%
rename from src/main/java/io/github/wimdeblauwe/hsbt/mvc/HtmxRequest.java
rename to htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxRequest.java
index f35fecbc..c321bd69 100644
--- a/src/main/java/io/github/wimdeblauwe/hsbt/mvc/HtmxRequest.java
+++ b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxRequest.java
@@ -1,4 +1,4 @@
-package io.github.wimdeblauwe.hsbt.mvc;
+package io.github.wimdeblauwe.htmx.spring.boot.mvc;
import org.springframework.lang.Nullable;
diff --git a/src/main/java/io/github/wimdeblauwe/hsbt/mvc/HtmxRequestHeader.java b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxRequestHeader.java
similarity index 90%
rename from src/main/java/io/github/wimdeblauwe/hsbt/mvc/HtmxRequestHeader.java
rename to htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxRequestHeader.java
index f3b028e1..485d4267 100644
--- a/src/main/java/io/github/wimdeblauwe/hsbt/mvc/HtmxRequestHeader.java
+++ b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxRequestHeader.java
@@ -1,4 +1,4 @@
-package io.github.wimdeblauwe.hsbt.mvc;
+package io.github.wimdeblauwe.htmx.spring.boot.mvc;
public enum HtmxRequestHeader {
HX_BOOSTED("HX-Boosted"),
diff --git a/src/main/java/io/github/wimdeblauwe/hsbt/mvc/HtmxRequestMappingHandlerMapping.java b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxRequestMappingHandlerMapping.java
similarity index 88%
rename from src/main/java/io/github/wimdeblauwe/hsbt/mvc/HtmxRequestMappingHandlerMapping.java
rename to htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxRequestMappingHandlerMapping.java
index e5b8fd2f..c2e7ffdd 100644
--- a/src/main/java/io/github/wimdeblauwe/hsbt/mvc/HtmxRequestMappingHandlerMapping.java
+++ b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxRequestMappingHandlerMapping.java
@@ -1,4 +1,4 @@
-package io.github.wimdeblauwe.hsbt.mvc;
+package io.github.wimdeblauwe.htmx.spring.boot.mvc;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.web.servlet.mvc.condition.HeadersRequestCondition;
@@ -7,7 +7,7 @@
import java.lang.reflect.Method;
-import static io.github.wimdeblauwe.hsbt.mvc.HtmxRequestHeader.HX_REQUEST;
+import static io.github.wimdeblauwe.htmx.spring.boot.mvc.HtmxRequestHeader.HX_REQUEST;
public class HtmxRequestMappingHandlerMapping extends RequestMappingHandlerMapping {
@Override
diff --git a/src/main/java/io/github/wimdeblauwe/hsbt/mvc/HtmxResponse.java b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxResponse.java
similarity index 99%
rename from src/main/java/io/github/wimdeblauwe/hsbt/mvc/HtmxResponse.java
rename to htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxResponse.java
index d1835c19..f10a1f37 100644
--- a/src/main/java/io/github/wimdeblauwe/hsbt/mvc/HtmxResponse.java
+++ b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxResponse.java
@@ -1,4 +1,4 @@
-package io.github.wimdeblauwe.hsbt.mvc;
+package io.github.wimdeblauwe.htmx.spring.boot.mvc;
import java.util.Collection;
import java.util.Collections;
diff --git a/src/main/java/io/github/wimdeblauwe/hsbt/mvc/HtmxResponseHeader.java b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxResponseHeader.java
similarity index 90%
rename from src/main/java/io/github/wimdeblauwe/hsbt/mvc/HtmxResponseHeader.java
rename to htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxResponseHeader.java
index e83d0c52..1cb80b73 100644
--- a/src/main/java/io/github/wimdeblauwe/hsbt/mvc/HtmxResponseHeader.java
+++ b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxResponseHeader.java
@@ -1,4 +1,4 @@
-package io.github.wimdeblauwe.hsbt.mvc;
+package io.github.wimdeblauwe.htmx.spring.boot.mvc;
public enum HtmxResponseHeader {
HX_PUSH("HX-Push"),
diff --git a/src/main/java/io/github/wimdeblauwe/hsbt/mvc/HtmxViewHandlerInterceptor.java b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxViewHandlerInterceptor.java
similarity index 99%
rename from src/main/java/io/github/wimdeblauwe/hsbt/mvc/HtmxViewHandlerInterceptor.java
rename to htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxViewHandlerInterceptor.java
index ef670aa8..3a00248a 100644
--- a/src/main/java/io/github/wimdeblauwe/hsbt/mvc/HtmxViewHandlerInterceptor.java
+++ b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxViewHandlerInterceptor.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.wimdeblauwe.hsbt.mvc;
+package io.github.wimdeblauwe.htmx.spring.boot.mvc;
import java.util.Locale;
import java.util.Map;
diff --git a/src/main/java/io/github/wimdeblauwe/hsbt/mvc/HxRefresh.java b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HxRefresh.java
similarity index 84%
rename from src/main/java/io/github/wimdeblauwe/hsbt/mvc/HxRefresh.java
rename to htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HxRefresh.java
index e809e805..0e3879a1 100644
--- a/src/main/java/io/github/wimdeblauwe/hsbt/mvc/HxRefresh.java
+++ b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HxRefresh.java
@@ -1,4 +1,4 @@
-package io.github.wimdeblauwe.hsbt.mvc;
+package io.github.wimdeblauwe.htmx.spring.boot.mvc;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
diff --git a/src/main/java/io/github/wimdeblauwe/hsbt/mvc/HxRequest.java b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HxRequest.java
similarity index 84%
rename from src/main/java/io/github/wimdeblauwe/hsbt/mvc/HxRequest.java
rename to htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HxRequest.java
index 14667c15..4364fac2 100644
--- a/src/main/java/io/github/wimdeblauwe/hsbt/mvc/HxRequest.java
+++ b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HxRequest.java
@@ -1,4 +1,4 @@
-package io.github.wimdeblauwe.hsbt.mvc;
+package io.github.wimdeblauwe.htmx.spring.boot.mvc;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
diff --git a/src/main/java/io/github/wimdeblauwe/hsbt/mvc/HxSwapType.java b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HxSwapType.java
similarity index 88%
rename from src/main/java/io/github/wimdeblauwe/hsbt/mvc/HxSwapType.java
rename to htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HxSwapType.java
index 1ea35b0e..480598f0 100644
--- a/src/main/java/io/github/wimdeblauwe/hsbt/mvc/HxSwapType.java
+++ b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HxSwapType.java
@@ -1,4 +1,4 @@
-package io.github.wimdeblauwe.hsbt.mvc;
+package io.github.wimdeblauwe.htmx.spring.boot.mvc;
public enum HxSwapType {
diff --git a/src/main/java/io/github/wimdeblauwe/hsbt/mvc/HxTrigger.java b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HxTrigger.java
similarity index 87%
rename from src/main/java/io/github/wimdeblauwe/hsbt/mvc/HxTrigger.java
rename to htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HxTrigger.java
index 1c2cee1c..71c171d5 100644
--- a/src/main/java/io/github/wimdeblauwe/hsbt/mvc/HxTrigger.java
+++ b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HxTrigger.java
@@ -1,4 +1,4 @@
-package io.github.wimdeblauwe.hsbt.mvc;
+package io.github.wimdeblauwe.htmx.spring.boot.mvc;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
diff --git a/src/main/java/io/github/wimdeblauwe/hsbt/mvc/HxTriggerLifecycle.java b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HxTriggerLifecycle.java
similarity index 90%
rename from src/main/java/io/github/wimdeblauwe/hsbt/mvc/HxTriggerLifecycle.java
rename to htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HxTriggerLifecycle.java
index 82c6ef79..6ef12376 100644
--- a/src/main/java/io/github/wimdeblauwe/hsbt/mvc/HxTriggerLifecycle.java
+++ b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HxTriggerLifecycle.java
@@ -1,4 +1,4 @@
-package io.github.wimdeblauwe.hsbt.mvc;
+package io.github.wimdeblauwe.htmx.spring.boot.mvc;
public enum HxTriggerLifecycle {
/**
diff --git a/src/main/java/io/github/wimdeblauwe/hsbt/security/HxRefreshHeaderAuthenticationEntryPoint.java b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/security/HxRefreshHeaderAuthenticationEntryPoint.java
similarity index 95%
rename from src/main/java/io/github/wimdeblauwe/hsbt/security/HxRefreshHeaderAuthenticationEntryPoint.java
rename to htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/security/HxRefreshHeaderAuthenticationEntryPoint.java
index 7d3c0746..0bfa4747 100644
--- a/src/main/java/io/github/wimdeblauwe/hsbt/security/HxRefreshHeaderAuthenticationEntryPoint.java
+++ b/htmx-spring-boot/src/main/java/io/github/wimdeblauwe/htmx/spring/boot/security/HxRefreshHeaderAuthenticationEntryPoint.java
@@ -1,4 +1,4 @@
-package io.github.wimdeblauwe.hsbt.security;
+package io.github.wimdeblauwe.htmx.spring.boot.security;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
diff --git a/htmx-spring-boot/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/htmx-spring-boot/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 00000000..2994466b
--- /dev/null
+++ b/htmx-spring-boot/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+io.github.wimdeblauwe.htmx.spring.boot.mvc.HtmxMvcAutoConfiguration
diff --git a/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/DummyApplication.java b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/DummyApplication.java
new file mode 100644
index 00000000..4cfd0f83
--- /dev/null
+++ b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/DummyApplication.java
@@ -0,0 +1,17 @@
+package io.github.wimdeblauwe.htmx.spring.boot;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
+
+/**
+ * Just created this here to make Spring Boot test slices work
+ */
+@SpringBootApplication(exclude = SecurityAutoConfiguration.class) // Security is on by default
+public class DummyApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(DummyApplication.class);
+ }
+
+}
diff --git a/src/test/java/io/github/wimdeblauwe/hsbt/mvc/CommonHtmxResponses.java b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/CommonHtmxResponses.java
similarity index 88%
rename from src/test/java/io/github/wimdeblauwe/hsbt/mvc/CommonHtmxResponses.java
rename to htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/CommonHtmxResponses.java
index 34bbe720..63b2a836 100644
--- a/src/test/java/io/github/wimdeblauwe/hsbt/mvc/CommonHtmxResponses.java
+++ b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/CommonHtmxResponses.java
@@ -1,4 +1,4 @@
-package io.github.wimdeblauwe.hsbt.mvc;
+package io.github.wimdeblauwe.htmx.spring.boot.mvc;
import org.springframework.ui.Model;
diff --git a/src/test/java/io/github/wimdeblauwe/hsbt/mvc/HtmxHandlerInterceptorIT.java b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxHandlerInterceptorIT.java
similarity index 96%
rename from src/test/java/io/github/wimdeblauwe/hsbt/mvc/HtmxHandlerInterceptorIT.java
rename to htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxHandlerInterceptorIT.java
index bce0eaa6..3b10da94 100644
--- a/src/test/java/io/github/wimdeblauwe/hsbt/mvc/HtmxHandlerInterceptorIT.java
+++ b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxHandlerInterceptorIT.java
@@ -1,4 +1,4 @@
-package io.github.wimdeblauwe.hsbt.mvc;
+package io.github.wimdeblauwe.htmx.spring.boot.mvc;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/src/test/java/io/github/wimdeblauwe/hsbt/mvc/HtmxHandlerInterceptorTest.java b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxHandlerInterceptorTest.java
similarity index 97%
rename from src/test/java/io/github/wimdeblauwe/hsbt/mvc/HtmxHandlerInterceptorTest.java
rename to htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxHandlerInterceptorTest.java
index 620dcbba..c963a4a3 100644
--- a/src/test/java/io/github/wimdeblauwe/hsbt/mvc/HtmxHandlerInterceptorTest.java
+++ b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxHandlerInterceptorTest.java
@@ -1,4 +1,4 @@
-package io.github.wimdeblauwe.hsbt.mvc;
+package io.github.wimdeblauwe.htmx.spring.boot.mvc;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/src/test/java/io/github/wimdeblauwe/hsbt/mvc/HtmxHandlerMethodArgumentResolverTest.java b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxHandlerMethodArgumentResolverTest.java
similarity index 99%
rename from src/test/java/io/github/wimdeblauwe/hsbt/mvc/HtmxHandlerMethodArgumentResolverTest.java
rename to htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxHandlerMethodArgumentResolverTest.java
index 3536761e..222e51ae 100644
--- a/src/test/java/io/github/wimdeblauwe/hsbt/mvc/HtmxHandlerMethodArgumentResolverTest.java
+++ b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxHandlerMethodArgumentResolverTest.java
@@ -1,4 +1,4 @@
-package io.github.wimdeblauwe.hsbt.mvc;
+package io.github.wimdeblauwe.htmx.spring.boot.mvc;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
diff --git a/src/test/java/io/github/wimdeblauwe/hsbt/mvc/HtmxHandlerMethodArgumentResolverTestController.java b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxHandlerMethodArgumentResolverTestController.java
similarity index 96%
rename from src/test/java/io/github/wimdeblauwe/hsbt/mvc/HtmxHandlerMethodArgumentResolverTestController.java
rename to htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxHandlerMethodArgumentResolverTestController.java
index 8d155286..d85acd14 100644
--- a/src/test/java/io/github/wimdeblauwe/hsbt/mvc/HtmxHandlerMethodArgumentResolverTestController.java
+++ b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxHandlerMethodArgumentResolverTestController.java
@@ -1,4 +1,4 @@
-package io.github.wimdeblauwe.hsbt.mvc;
+package io.github.wimdeblauwe.htmx.spring.boot.mvc;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
diff --git a/src/test/java/io/github/wimdeblauwe/hsbt/mvc/HtmxPartialHandlerInterceptorTest.java b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxPartialHandlerInterceptorTest.java
similarity index 86%
rename from src/test/java/io/github/wimdeblauwe/hsbt/mvc/HtmxPartialHandlerInterceptorTest.java
rename to htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxPartialHandlerInterceptorTest.java
index aa28c343..aeb9f582 100644
--- a/src/test/java/io/github/wimdeblauwe/hsbt/mvc/HtmxPartialHandlerInterceptorTest.java
+++ b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxPartialHandlerInterceptorTest.java
@@ -1,6 +1,6 @@
-package io.github.wimdeblauwe.hsbt.mvc;
+package io.github.wimdeblauwe.htmx.spring.boot.mvc;
-import static io.github.wimdeblauwe.hsbt.mvc.support.PartialXpathResultMatchers.partialXpath;
+import static io.github.wimdeblauwe.htmx.spring.boot.mvc.support.PartialXpathResultMatchers.partialXpath;
import static org.hamcrest.core.StringContains.containsString;
import static org.mockito.Mockito.when;
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf;
@@ -103,20 +103,4 @@ public void testPostTodo() throws Exception {
.andExpect(partialXpath("/span[@id='item'][@hx-swap-oob]").doesNotExist());
}
- @Test
- public void testHtmxRequestExpressionUtility() throws Exception {
- mockMvc.perform(get("/partials/expressionUtility").header("HX-Request", "true"))
- .andExpect(status().isOk())
- .andExpect(xpath("//div[@id='htmxRequest']").exists());
- }
-
- @Test
- public void testHtmxRequestExpressionUtilityWorkEvenWhenNotHtmxRequest() throws Exception {
- mockMvc.perform(get("/partials/expressionUtility")) //No HX-Request header
- .andExpect(status().isOk())
- .andExpect(xpath("//div[@id='htmxRequest']").doesNotExist());
- }
-
-
-
}
diff --git a/src/test/java/io/github/wimdeblauwe/hsbt/mvc/HtmxResponseTest.java b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxResponseTest.java
similarity index 98%
rename from src/test/java/io/github/wimdeblauwe/hsbt/mvc/HtmxResponseTest.java
rename to htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxResponseTest.java
index 18bab5fa..46912273 100644
--- a/src/test/java/io/github/wimdeblauwe/hsbt/mvc/HtmxResponseTest.java
+++ b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HtmxResponseTest.java
@@ -1,4 +1,4 @@
-package io.github.wimdeblauwe.hsbt.mvc;
+package io.github.wimdeblauwe.htmx.spring.boot.mvc;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
diff --git a/src/test/java/io/github/wimdeblauwe/hsbt/mvc/HxGetMapping.java b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HxGetMapping.java
similarity index 92%
rename from src/test/java/io/github/wimdeblauwe/hsbt/mvc/HxGetMapping.java
rename to htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HxGetMapping.java
index 7a77ae94..9f980efc 100644
--- a/src/test/java/io/github/wimdeblauwe/hsbt/mvc/HxGetMapping.java
+++ b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HxGetMapping.java
@@ -1,4 +1,4 @@
-package io.github.wimdeblauwe.hsbt.mvc;
+package io.github.wimdeblauwe.htmx.spring.boot.mvc;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
diff --git a/src/test/java/io/github/wimdeblauwe/hsbt/mvc/HxTriggerWithAliasFor.java b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HxTriggerWithAliasFor.java
similarity index 89%
rename from src/test/java/io/github/wimdeblauwe/hsbt/mvc/HxTriggerWithAliasFor.java
rename to htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HxTriggerWithAliasFor.java
index b5fd4996..b8cedbb2 100644
--- a/src/test/java/io/github/wimdeblauwe/hsbt/mvc/HxTriggerWithAliasFor.java
+++ b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HxTriggerWithAliasFor.java
@@ -1,4 +1,4 @@
-package io.github.wimdeblauwe.hsbt.mvc;
+package io.github.wimdeblauwe.htmx.spring.boot.mvc;
import org.springframework.core.annotation.AliasFor;
diff --git a/src/test/java/io/github/wimdeblauwe/hsbt/mvc/HxUpdatesSidebar.java b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HxUpdatesSidebar.java
similarity index 88%
rename from src/test/java/io/github/wimdeblauwe/hsbt/mvc/HxUpdatesSidebar.java
rename to htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HxUpdatesSidebar.java
index d80c6259..66a91f4e 100644
--- a/src/test/java/io/github/wimdeblauwe/hsbt/mvc/HxUpdatesSidebar.java
+++ b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/HxUpdatesSidebar.java
@@ -1,4 +1,4 @@
-package io.github.wimdeblauwe.hsbt.mvc;
+package io.github.wimdeblauwe.htmx.spring.boot.mvc;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
diff --git a/src/test/java/io/github/wimdeblauwe/hsbt/mvc/PartialsController.java b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/PartialsController.java
similarity index 94%
rename from src/test/java/io/github/wimdeblauwe/hsbt/mvc/PartialsController.java
rename to htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/PartialsController.java
index 727f5e92..d84e1f7d 100644
--- a/src/test/java/io/github/wimdeblauwe/hsbt/mvc/PartialsController.java
+++ b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/PartialsController.java
@@ -1,6 +1,4 @@
-package io.github.wimdeblauwe.hsbt.mvc;
-
-import static io.github.wimdeblauwe.hsbt.mvc.CommonHtmxResponses.sendAlertPartial;
+package io.github.wimdeblauwe.htmx.spring.boot.mvc;
import java.util.Map;
@@ -110,7 +108,7 @@ public HtmxResponse getPartialsViaExtension(Model model) {
return new HtmxResponse().addTemplate("users :: list")
.addTemplate("users :: count")
- .and(sendAlertPartial(model, "Warning! Odium approaches!"));
+ .and(CommonHtmxResponses.sendAlertPartial(model, "Warning! Odium approaches!"));
}
diff --git a/src/test/java/io/github/wimdeblauwe/hsbt/mvc/TestController.java b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/TestController.java
similarity index 96%
rename from src/test/java/io/github/wimdeblauwe/hsbt/mvc/TestController.java
rename to htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/TestController.java
index 75fd0ec8..bec130c0 100644
--- a/src/test/java/io/github/wimdeblauwe/hsbt/mvc/TestController.java
+++ b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/TestController.java
@@ -1,4 +1,4 @@
-package io.github.wimdeblauwe.hsbt.mvc;
+package io.github.wimdeblauwe.htmx.spring.boot.mvc;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
diff --git a/src/test/java/io/github/wimdeblauwe/hsbt/mvc/TestService.java b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/TestService.java
similarity index 72%
rename from src/test/java/io/github/wimdeblauwe/hsbt/mvc/TestService.java
rename to htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/TestService.java
index 1528067e..1025a6d6 100644
--- a/src/test/java/io/github/wimdeblauwe/hsbt/mvc/TestService.java
+++ b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/TestService.java
@@ -1,4 +1,4 @@
-package io.github.wimdeblauwe.hsbt.mvc;
+package io.github.wimdeblauwe.htmx.spring.boot.mvc;
import org.springframework.stereotype.Service;
diff --git a/src/test/java/io/github/wimdeblauwe/hsbt/mvc/support/PartialXpathResultMatchers.java b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/support/PartialXpathResultMatchers.java
similarity index 99%
rename from src/test/java/io/github/wimdeblauwe/hsbt/mvc/support/PartialXpathResultMatchers.java
rename to htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/support/PartialXpathResultMatchers.java
index d5b9f2bb..98a58d1e 100644
--- a/src/test/java/io/github/wimdeblauwe/hsbt/mvc/support/PartialXpathResultMatchers.java
+++ b/htmx-spring-boot/src/test/java/io/github/wimdeblauwe/htmx/spring/boot/mvc/support/PartialXpathResultMatchers.java
@@ -1,4 +1,4 @@
-package io.github.wimdeblauwe.hsbt.mvc.support;
+package io.github.wimdeblauwe.htmx.spring.boot.mvc.support;
import org.hamcrest.Matcher;
import org.springframework.lang.Nullable;
diff --git a/htmx-spring-boot/src/test/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc.imports b/htmx-spring-boot/src/test/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc.imports
new file mode 100644
index 00000000..2994466b
--- /dev/null
+++ b/htmx-spring-boot/src/test/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc.imports
@@ -0,0 +1 @@
+io.github.wimdeblauwe.htmx.spring.boot.mvc.HtmxMvcAutoConfiguration
diff --git a/src/test/resources/templates/fragments.html b/htmx-spring-boot/src/test/resources/templates/fragments.html
similarity index 92%
rename from src/test/resources/templates/fragments.html
rename to htmx-spring-boot/src/test/resources/templates/fragments.html
index cce166c9..dcd9d4ae 100644
--- a/src/test/resources/templates/fragments.html
+++ b/htmx-spring-boot/src/test/resources/templates/fragments.html
@@ -2,7 +2,7 @@
0 items left
diff --git a/src/test/resources/templates/users.html b/htmx-spring-boot/src/test/resources/templates/users.html
similarity index 52%
rename from src/test/resources/templates/users.html
rename to htmx-spring-boot/src/test/resources/templates/users.html
index 4ae45183..b9ae98b5 100644
--- a/src/test/resources/templates/users.html
+++ b/htmx-spring-boot/src/test/resources/templates/users.html
@@ -2,6 +2,6 @@ Users
-There are 10 users.
+There are 10 users.
diff --git a/pom.xml b/pom.xml
index 7548a042..12f57490 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,17 +2,19 @@
4.0.0
+
org.springframework.boot
spring-boot-starter-parent
- 3.0.0
+ 3.1.2
+
io.github.wimdeblauwe
- htmx-spring-boot-thymeleaf
- 2.2.0
- Spring Boot and Thymeleaf library for htmx
- Spring Boot library to make it easy to work with htmx and Thymeleaf
+ htmx-spring-boot-parent
+ 3.0.0-SNAPSHOT
+ pom
+ Parent of Spring Boot library for htmx
UTF-8
@@ -22,12 +24,14 @@
1.6.13
0.8.8
+
The Apache Software License, Version 2.0
http://www.apache.org/licenses/LICENSE-2.0.txt
+
Wim Deblauwe
@@ -35,57 +39,24 @@
https://github.com/wimdeblauwe
+
+
scm:git:git@github.com:wimdeblauwe/htmx-spring-boot-thymeleaf.git
scm:git:git@github.com:wimdeblauwe/htmx-spring-boot-thymeleaf.git
git@github.com:wimdeblauwe/htmx-spring-boot-thymeleaf.git
+
github
+
https://github.com/wimdeblauwe/htmx-spring-boot-thymeleaf/issues
-
-
- org.springframework.boot
- spring-boot-starter
-
-
- org.springframework.boot
- spring-boot-configuration-processor
- true
-
-
- org.springframework.boot
- spring-boot-autoconfigure-processor
- true
-
-
- org.springframework.boot
- spring-boot-starter-web
- true
-
-
- org.springframework.boot
- spring-boot-starter-thymeleaf
- true
-
-
- org.springframework.boot
- spring-boot-starter-security
- true
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
- org.springframework.security
- spring-security-test
- test
-
-
+
+ htmx-spring-boot
+ htmx-spring-boot-thymeleaf
+
@@ -143,50 +114,49 @@
report
+
+
+
+
+ -->
@@ -248,7 +218,6 @@
org.apache.maven.plugins
maven-gpg-plugin
- ${maven-gpg-plugin.version}
--pinentry-mode
diff --git a/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
deleted file mode 100644
index 53a2c747..00000000
--- a/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
+++ /dev/null
@@ -1,2 +0,0 @@
-io.github.wimdeblauwe.hsbt.thymeleaf.HtmxThymeleafConfiguration
-io.github.wimdeblauwe.hsbt.mvc.HtmxMvcConfiguration
diff --git a/src/main/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc.imports b/src/main/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc.imports
deleted file mode 100644
index 53a2c747..00000000
--- a/src/main/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc.imports
+++ /dev/null
@@ -1,2 +0,0 @@
-io.github.wimdeblauwe.hsbt.thymeleaf.HtmxThymeleafConfiguration
-io.github.wimdeblauwe.hsbt.mvc.HtmxMvcConfiguration