https://github.com/danielfernandez/test-nested-springel-conversion
Test repository for thymeleaf/thymeleaf-spring#128
https://github.com/danielfernandez/test-nested-springel-conversion
Last synced: 12 months ago
JSON representation
Test repository for thymeleaf/thymeleaf-spring#128
- Host: GitHub
- URL: https://github.com/danielfernandez/test-nested-springel-conversion
- Owner: danielfernandez
- Created: 2017-02-04T15:49:40.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-04T15:52:09.000Z (over 9 years ago)
- Last Synced: 2025-03-25T22:35:39.921Z (about 1 year ago)
- Language: Shell
- Size: 51.8 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
Awesome Lists containing this project
README
Test: Thymeleaf nested conversion with SpringEL
=======================================
This repository checks a reported change in behaviour for the conversion (via a Spring `Formatter`) of a nested property, depending on whether the property is declared in the containing bean as of being of its specific type, or a superclass (which has no registered `Formatter`).
See thymeleaf/thymeleaf-spring#128
### Contents
This repository contains two folders with almost exactly the same application code, except one of them uses Thymeleaf 2.1.5 and the other one Thymeleaf 3.0.3.
Both applications are based on Spring Boot 1.4.3.
The Thymeleaf 2.1.5 app starts on port `8080`. The Thymeleaf 3.0.3 app starts on port `8081`, so they can be started at the same time.
Both apps can be started with:
```
$ mvn -U clean compile spring-boot:run
```
### Implementation
The `Bean` class contains two fields:
```java
private AbstractField fieldAbs = null;
private Field fieldConc = null;
```
The `Field` class extends `AbstractField`. At the controller a `bean` variable of this `Bean` class is initialised as:
```java
@RequestMapping("/")
public String main(final Model model) {
final Bean bean = new Bean();
bean.setFieldAbs(new Field(100));
bean.setFieldConc(new Field(500));
model.addAttribute("bean", bean);
return "main";
}
```
Using a browser and pointing to the root of the web apps, the `main.html` template will show all the possible combinations for SpringEL conversion being applied:
```html
Outside Form
Abstract Field:
- Without th:object: ...
- With th:object: ...
Concrete Field:
- Without th:object ...
- With th:object ...
Inside Form
Abstract field:
Concrete field:
```
Both applications **show the same results**, so the reported differences in behaviour between 2.1.5 and 3.0.3 could not be confirmed.