Fork me on GitHub

OfficeFloor Tutorials

The tutorials show how to progressively 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 — compose 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 — assign dedicated thread pools to steps based solely on their dependencies. Socket threads never block on database calls.

The journey is structured as follows:

  1. Spring Boot — Add OfficeFloor REST YAML composition to your existing Spring Boot application. No migration required.
  2. Spring in OfficeFloor — Host your Spring beans inside the OfficeFloor runtime. All existing Spring configuration continues to work; further OfficeFloor capabilities become available.
  3. Native OfficeFloor — Optional. If there is interest in removing the Spring dependency entirely, explore the full breadth of native OfficeFloor functionality.
  4. OfficeFloor Features — Advanced capabilities available in the OfficeFloor runtime: reactive streams and polyglot procedure logic.
  5. Cloud and Deployment — Deploy OfficeFloor applications to cloud platforms and cloud-native datastores.

REST endpoints are declared as YAML configuration files throughout this journey. 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.

Phase 1: 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

Phase 2: Spring in OfficeFloor

In this phase the OfficeFloor runtime takes ownership of the HTTP server while your existing Spring configuration continues to supply dependency-injected beans. No Spring code changes are required. Moving to this phase unlocks further OfficeFloor capabilities — such as native thread injection and the full WoOF infrastructure layer — while the familiar Spring programming model remains intact.

Spring Beans

Host Spring beans directly as OfficeFloor managed objects. Your Spring @Service, @Repository, and @Component beans are available for injection into any OfficeFloor procedure exactly as they are in a Spring Boot application.

Tutorial Description Covered
Spring Beans Host Spring beans inside the OfficeFloor runtime. Spring is used purely as a dependency supplier; all beans remain available for injection. SpringSupplierSource 
Spring beans as managed objects

Spring Web MVC in OfficeFloor

Host an existing Spring Web MVC application inside the OfficeFloor runtime. Existing @Controller endpoints continue to work; YAML REST procedures can be added alongside them.

Tutorial Description Covered
Spring Web MVC Run Spring Web MVC @Controller endpoints within OfficeFloor while adding YAML REST procedures. Spring Web MVC 
@Controller in OfficeFloor

Spring Web Flux in OfficeFloor

Host an existing Spring Web Flux application inside the OfficeFloor runtime.

Tutorial Description Covered
Spring Web Flux Run Spring Web Flux @Controller endpoints within OfficeFloor while adding YAML REST procedures. Spring Web Flux 
@Controller in OfficeFloor

Phase 3: Native OfficeFloor

Optional. If there is interest in removing Spring as a runtime dependency, OfficeFloor can run without it. All REST YAML files, service classes, and team configurations carry over unchanged. The following tutorials explore the complete set of native OfficeFloor capabilities organised by concern.

Core REST and Dependency Injection

The foundation tutorials for native OfficeFloor REST applications.

Tutorial Description Covered
REST Declare REST endpoints as YAML configuration; dependency inject request data and services. REST 
@PathParameter , HttpException
Dependency Injection Dependency inject plain old Java objects (POJOs) into REST procedures. Dependency Injection
Environment Configure application behaviour across environments using properties and profiles. @Property , Profile
Logging Inject loggers that identify their location within the application. Logger
Variables Pass state downstream through a procedure flow without coupling callers to callees. Out<T> , @Val
OpenAPI / Swagger Generate OpenAPI documentation from native OfficeFloor REST YAML endpoint declarations. OpenAPI 
Swagger
CORS Configure Cross-Origin Resource Sharing using OfficeFloor web interceptors. CORS 
Web intercepting
Exception Handling Handle and map exceptions within native OfficeFloor REST flows. @Parameter 
Exception handling

Persistence

Connecting native OfficeFloor applications to relational databases.

Tutorial Description Covered
Database Dependency inject a customised managed object backed by a database connection pool. ManagedObjectSource
Transaction Govern transactions across multiple procedures within a REST flow. Governance
Flyway Run Flyway schema migrations on application start up. Flyway

Security

Authentication and authorisation for native OfficeFloor REST applications.

Tutorial Description Covered
Authentication Configure HTTP authentication across REST endpoints. Authentication
JWT Single-server application with combined JWT security and authority. JWT Security 
JWT Authority
JWT Authority Dedicated JWT authority server issuing and renewing tokens. JWT Authority
JWT Resource JWT-secured resource server validating tokens issued by a separate authority. JWT Security
Session Store and retrieve state between requests using the HTTP session. @HttpSessionStateful
Secure Page Require HTTPS for an entire page and its links. Template Secure
Secure Link Require HTTPS for an individual link within a page. Link Secure

Infrastructure and Concurrency

OfficeFloor's IOCC model provides fine-grained control over threads, start-up ordering, caching, and modularisation. These tutorials explore that infrastructure layer.

Tutorial Description Covered
Thread Injection Assign specific thread teams to procedures to performance-tune the application. Thread Injection
Thread Affinity Bind procedures to CPU cores using the Executive for cache-friendly execution. Executive
Start-up Ordering Declare ordered start-up dependencies between ManagedObjectSource instances. start-before , start-after
Cache Cache constant values to avoid repeated computation or lookup. Cache
Activity Modularise REST YAML configuration into reusable Activity units. Activity (Section)
Testing Unit, system, and integration test OfficeFloor REST applications. Unit / System / Integration testing

Static Content

For modern single-page applications, the REST YAML endpoints provide the API and static assets are served directly from the classpath.

Tutorial Description Covered
Static Content Serve SPA assets (HTML, CSS, JavaScript) from the PUBLIC/ classpath directory alongside REST endpoints. /PUBLIC

Phase 4: OfficeFloor Features

Advanced capabilities available in the OfficeFloor runtime: integrating reactive streams and writing procedure logic in JVM languages other than Java.

Reactive

OfficeFloor's threading model integrates cleanly with reactive libraries. These tutorials demonstrate how to wire reactive streams and reactive database clients as procedures in REST YAML composition.

Tutorial Description Covered
Reactor Integrate Project Reactor publishers and subscribers as OfficeFloor procedures. Project Reactor 
Reactive streams
R2DBC Reactive relational database access using R2DBC within OfficeFloor REST composition. R2DBC 
Reactive database
Vertx SQL Client High-performance database interaction using the Vert.x SQL Client. Vertx SQL Client

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

Phase 5: Cloud and Deployment

Cloud Platforms

Deploy native OfficeFloor applications to major cloud and serverless platforms.

Tutorial Description Covered
Deploy Package and deploy an OfficeFloor application including Docker containerisation. Deploy , Docker
AWS SAM Deploy as an AWS Serverless Application Model (SAM) function. AWS Serverless
Google Function Deploy as a Google Cloud Function. Google Cloud Function
Azure Web Apps Deploy to Azure Web Apps. Azure Web Apps

Cloud Datastores

Integrate cloud-native datastores into OfficeFloor REST applications as managed objects.

Tutorial Description Covered
DynamoDB Integrate Amazon DynamoDB as an OfficeFloor managed object. DynamoDB
Cosmos DB Integrate Azure Cosmos DB (synchronous client) as an OfficeFloor managed object. Cosmos DB
Async Cosmos DB Integrate Azure Cosmos DB (asynchronous client) as an OfficeFloor managed object. Async Cosmos DB
Firestore Integrate Google Cloud Firestore as an OfficeFloor managed object. Firestore
Objectify Integrate Google Cloud Datastore via Objectify as an OfficeFloor managed object. Objectify

Legacy Integration

For applications that must co-exist with a Servlet container, WAR deployment, or JAX-RS framework. The step-by-step guides below show how to embed each legacy format and then progressively migrate to native OfficeFloor.

JEE Web Archive (WAR / Servlets)

Step Tutorial Description Covered
1 Embed WAR Run a JEE WAR within OfficeFloor. WAR
2 Servlet Procedures Integrate Servlets and Filters as OfficeFloor Procedures. Servlet / Filter Procedure
3 Migrate Servlet Remove the JEE Servlet dependency and run natively on OfficeFloor. Migrate Servlet / Filter

JAX-RS

Step Tutorial Description Covered
1 Embed JAX-RS Run JAX-RS resources within OfficeFloor as a WAR. JAX-RS WAR
2 JAX-RS Procedures Integrate JAX-RS resource methods as OfficeFloor Procedures. JAX-RS Procedure
3 Migrate JAX-RS Remove the JAX-RS dependency and run natively on OfficeFloor. Migrate JAX-RS

HttpServlet Container Embedding

Tutorial Description Covered
Embed in HttpServlet Container Embed WoOF inside an existing HttpServlet container such as Tomcat or Jetty. Servlet , PaaS / Cloud

Reference Applications

These applications exist to confirm integration correctness. They are not step-by-step tutorials.

Application Description
Spring Web MVC App Standalone Spring Web MVC application used to confirm OfficeFloor integration correctness.
Spring Web Flux App Standalone Spring Web Flux application used to confirm OfficeFloor integration correctness.
JAX-RS App Standalone JAX-RS application used to confirm OfficeFloor integration correctness.