Class HelloController
java.lang.Object
io.jstach.opt.spring.webflux.example.hello.HelloController
Example hello world controller using different ways to use JStachio for web
development.
- Author:
- agentgt
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionhello()
Here we use JStachio runtime to resolve the renderer (in this case we are calling them Views) via Springs Http Message Converter.org.springframework.web.reactive.result.view.View
mvc()
Here we useJStacheInterfaces
to make our model implement a Spring View to support the traditional servlet MVC approach.
-
Constructor Details
-
HelloController
public HelloController()Placate JDK 18 Javadoc
-
-
Method Details
-
hello
Here we use JStachio runtime to resolve the renderer (in this case we are calling them Views) via Springs Http Message Converter.- Returns:
- the model that will be used to find the correct view and then rendered using that view
- See Also:
- API Note
- Notice that the method has to be annotated with
@ResponseBody
.
-
mvc
Here we useJStacheInterfaces
to make our model implement a Spring View to support the traditional servlet MVC approach. The model will use the static jstachio singleton that will be the spring one.This approach has pros and cons. It makes your models slightly coupled to Spring MVC but allows you to return different views if say you had to redirect on some inputs (
RedirectView
).- Returns:
- the model that will be used as View
- See Also:
- API Note
- Notice that the return type is
View
.
-