OfficeFloor Tutorials

The tutorials show how to add OfficeFloor capabilities to an existing Spring Boot application. Spring's dependency injection, security, persistence, and all other Spring configuration remain intact at every stage. OfficeFloor enriches, not replaces.

OfficeFloor extends dependency injection with two further kinds of injection:

  • Function injection composes plain Java methods into a request-handling pipeline declared entirely in a YAML file. The YAML is the specification: readable without opening any Java file, which is especially valuable when working with AI coding tools.
  • Thread injection assigns dedicated thread pools to steps based solely on their dependencies. Socket threads never block on database calls.

The tutorials are structured as follows:

  1. Spring Boot adds OfficeFloor REST YAML composition to your existing Spring Boot application. No migration required.
  2. Spring WebFlux shows how to reuse existing Spring WebFlux components within a Spring MVC application, taking advantage of Virtual Threads as they render Spring WebFlux increasingly unnecessary.
  3. Polyglot covers writing procedure logic in Kotlin, Scala, JavaScript, or other JVM languages alongside Java procedures.

REST endpoints are declared as YAML configuration files throughout these tutorials. This allows teams to work concurrently on separate endpoint files and gives AI tooling the context it needs to generate and modify endpoint code accurately.

All tutorials are part of the OfficeFloor continuous builds and their source can be found here.

Spring Boot

For developers already using Spring Boot, this is the starting point. The OfficeFloor REST Spring Boot Starter adds REST YAML composition to your existing Spring Boot application without requiring any code migration. Your Spring beans, security, persistence, and all other Spring configuration remain unchanged. OfficeFloor simply takes over the declaration of REST endpoints via YAML files.

Tutorial Description Covered
Spring REST Declare REST endpoints as YAML configuration files within a Spring Boot application. Spring beans are injected into service methods automatically. OfficeFloor REST Spring Boot Starter 
REST YAML composition 
Function injection basics
Function Injection Compose a multi-step request pipeline via YAML. Conditional branching with @Flow, sequential continuation with return values, and typed data passing between steps. @Flow 
@Parameter 
Pipeline composition
Exception Handling Handle exceptions thrown from REST service methods and map them to HTTP responses. @ExceptionHandler 
REST error handling
Validation Validate request payloads and path parameters using Bean Validation. @Valid 
ConstraintViolationException
Spring Security Secure REST endpoints using Spring Security with OfficeFloor REST composition. Spring Security 
HTTP authorisation
CORS Configure Cross-Origin Resource Sharing for REST endpoints. CORS 
@CrossOrigin
OpenAPI / Swagger Generate OpenAPI documentation from REST YAML endpoint declarations. OpenAPI 
Swagger UI
Thymeleaf Render Thymeleaf server-side templates from OfficeFloor REST YAML composition. Thymeleaf 
Server-side rendering
Servlet Interop Inject HttpServletRequest and HttpServletResponse directly into REST service methods. HttpServletRequest 
HttpServletResponse
Qualifier Disambiguate multiple Spring beans of the same type using @Qualifier in service methods. @Qualifier 
Bean disambiguation
Spring Data JPA Integrate Spring Data JPA repositories with transaction governance in REST YAML composition. Spring Data JPA 
@Transactional governance
Thread Injection Assign dedicated thread pools to steps based on their dependencies. Socket threads are freed immediately; blocking database calls run on a separate team. Teams 
Thread injection 
officefloor/teams/
Actuator Spring Boot Actuator health, info, and metrics endpoints continue to work alongside OfficeFloor REST YAML endpoints with no additional configuration. spring-boot-starter-actuator 
/actuator/health

Spring WebFlux

Virtual Threads in modern JVMs remove the scalability advantage that Spring WebFlux was built to address. Rather than discarding existing reactive components, this tutorial shows how to host them inside a Spring MVC application so you retain the investment while gaining the simplicity of synchronous programming with Virtual Threads.

Tutorial Description Covered
Spring WebFlux in Spring MVC Reuse existing Spring WebFlux @Controller components within a Spring MVC application. Virtual Threads deliver the same non-blocking throughput without a reactive programming model. Spring WebFlux 
Virtual Threads 
Spring MVC interop

Variables

Variables allow state to be passed downstream through a procedure flow without coupling callers to callees. This is useful for threading contextual data through a multi-step pipeline declared in YAML.

Tutorial Description Covered
Variables Pass state downstream through a procedure flow without coupling callers to callees. Out<T> , @Val

Polyglot

OfficeFloor procedures can be written in any JVM language. Mix Kotlin, Scala, or JavaScript logic into the same REST YAML endpoint graph as Java procedures.

Tutorial Description Covered
Kotlin Implement REST procedure logic in Kotlin alongside Java procedures. Polyglot Kotlin
Scala Implement REST procedure logic in Scala alongside Java procedures. Polyglot Scala
JavaScript Implement REST procedure logic in JavaScript via GraalVM. Polyglot JavaScript 
GraalVM
Cats Effect Integrate Cats Effect functional IO into OfficeFloor REST composition. Cats Effect
ZIO Integrate ZIO functional effects into OfficeFloor REST composition. ZIO

Migration

If you are interested in a deeper integration, such as hosting Spring beans directly in the OfficeFloor runtime, running without Spring, or deploying to cloud platforms, the Migration Guide covers the full journey.