81 lines
3.9 KiB
Markdown
81 lines
3.9 KiB
Markdown
# Spring contact book
|
|
|
|
This Maven fixture runs as a JavaFX application and as a NeitzelFXDesigner
|
|
preview. It uses Spring Framework 6.2.11, NeitzelLib `1.0.7`,
|
|
JavaFX 27.0.1 in the target and JDK 25. Views use the same FXML and adapter
|
|
in both environments. Spring owns the application services. Each Controller
|
|
and Component is a prototype.
|
|
|
|
## Run it
|
|
|
|
Set `JAVA_HOME` to JDK 25. The fixture resolves the released NeitzelLib
|
|
artifacts from the Gitea Maven registry. From the Designer checkout:
|
|
|
|
```sh
|
|
export DI_MAVEN_REPOSITORY="/absolute/path/to/di-repository"
|
|
export MAVEN_OPTS="-Dmaven.repo.local=$DI_MAVEN_REPOSITORY"
|
|
./mvnw -B -ntp install
|
|
./mvnw -f integration-fixtures/spring-di/app/pom.xml javafx:run
|
|
```
|
|
|
|
Edit the book name to see the Spring-supplied Converter update the caption.
|
|
Closing the window first destroys its prototypes, then stops the shared
|
|
service. The [application bootstrap](app/src/main/java/fixture/spring/app/SpringBook.java)
|
|
uses the managed `ViewLoader`. The [Spring registration](app/src/main/java/fixture/spring/app/SpringBookContext.java)
|
|
assigns separate scopes to the view types and services.
|
|
|
|
## Open the previews
|
|
|
|
From the Designer checkout, set up the ignored local paths once:
|
|
|
|
```sh
|
|
python3 scripts/configure-library-example.py \
|
|
--project integration-fixtures/spring-di --target-java-home "$JAVA_HOME"
|
|
```
|
|
|
|
Use the same local Maven repository when starting the Designer or IntelliJ.
|
|
Open `app/src/main/resources/fixture/spring/ui/Book.fxml`, select
|
|
**Build and Refresh** and then **Form preview** or **Interactive preview**.
|
|
The preview starts with `Preview contact book`; changes to it belong to
|
|
that preview. **Stop preview** closes the session. Open `EntryCard.fxml`
|
|
and start its separate example to see that Component as a standalone root.
|
|
|
|
The [Book provider](preview/src/main/java/fixture/spring/preview/BookExamples.java)
|
|
creates a fresh Model and Spring context. The [Component provider](preview/src/main/java/fixture/spring/preview/CardExamples.java)
|
|
returns its own Model and context. Both provide the application
|
|
[adapter](app/src/main/java/fixture/spring/app/SpringViews.java).
|
|
FXML resources and fields in `fixture.spring.ui` are accessible in the
|
|
[application module](app/src/main/java/module-info.java). The
|
|
[preview module](preview/src/main/java/module-info.java) exposes its providers.
|
|
The package named by `componentPackage` stays closed to demonstrate that
|
|
the Spring worker uses FXML resource access and the registered Spring beans.
|
|
|
|
## Run the checks
|
|
|
|
From the Designer checkout, using the same JDK and local Maven repository:
|
|
|
|
```sh
|
|
python3 scripts/check-preview-fixtures.py --spring-di --target-java-home "$JAVA_HOME"
|
|
./designer-intellij/gradlew -p designer-intellij -PideaHome="$IDEA_HOME" \
|
|
-Dmaven.repo.local="$DI_MAVEN_REPOSITORY" buildPlugin
|
|
./mvnw -pl designer-standalone \
|
|
org.apache.maven.plugins:maven-dependency-plugin:3.6.1:build-classpath \
|
|
-DincludeScope=test -Dmdep.outputFile=target/smoke-classpath.txt
|
|
python3 scripts/check-spring-hosts.py --java-home "$JAVA_HOME" \
|
|
--target-java-home "$JAVA_HOME" --idea-home "$IDEA_HOME"
|
|
```
|
|
|
|
The worker checks include two simultaneous Views, separate scopes, nested
|
|
Components, Repeat and Table release, cleanup after load/readiness failure
|
|
and cancellation, module resource diagnostics, and the required runtime
|
|
diagnostic against FX 1.0.6. The host checks use disposably copied project
|
|
files and exercise the canvas, form preview and interactive preview.
|
|
The interactive check captures the initial field value before the native
|
|
window becomes visible and exercises editing in the opened window.
|
|
|
|
Each Spring context verifies that the running application or preview
|
|
cannot load Neitzel's `ApplicationContext` or Reflections and that
|
|
their JARs are absent from its classpath and module path. The test
|
|
runner separately verifies the normal Maven dependency trees. Its
|
|
missing-API check resolves FX 1.0.6 from a separate POM.
|