Fork me on GitHub

Spring Web Flux Procedure Tutorial

This tutorial demonstrates configuring a Spring Web Flux Controller as a procedure.

Adding a Spring Web Flux Controller as a procedure, allows re-use of existing code. Ideally, over time, the Spring Web Flux Controllers are simplified to methods taking advantage of OfficeFloor's IoCC. However, Spring Web Flux Controllers are supported as procedures to avoid significant rewrites of application code. This enables taking advantage of OfficeFloor's features with existing Spring code.

Tutorial Source

Configuring Spring Web Flux Controller

Please see the Spring Web Flux Controller Tutorial regarding configuring Spring Web Flux Controllers into WoOF. The tutorial needs to be followed to also enable Spring Web Flux Controllers to be configured as procedures.

Configuring as a Procedure

Select the Spring Web Flux Controller as a class when adding a procedure.

Note: the Controller must be on the application's Spring scan path.

The tutorial configuration is as follows:

SpringWebFluxHttpServer configuration.

Note that the WoOF configured paths can be different to the Spring Web Flux Controller request mappings. The only constraint on this is that the path parameters must match.


The following tests demonstrates the procedures.

	public static final MockWoofServerExtension server = new MockWoofServerExtension();

	public void get() {
		MockWoofResponse response = server.send(MockWoofServer.mockRequest("/officefloor/rest"));
		response.assertJson(200, new ResponseModel("GET Spring Dependency"));

	public void pathParam() {
		MockWoofResponse response = server.send(MockWoofServer.mockRequest("/officefloor/changed/parameter"));
		response.assertJson(200, new ResponseModel("parameter"));

	public void put() {
		MockWoofResponse response = server
				.send(MockWoofServer.mockJsonRequest(HttpMethod.PUT, "/officefloor/update", new RequestModel("INPUT")));
		response.assertJson(200, new ResponseModel[] { new ResponseModel("INPUT"), new ResponseModel("ANOTHER") });


The next tutorial covers migrating Spring Web Flux Controllers for simpler code and avoid the dependency on Spring.