Instantly share code, notes, and snippets.

What would you like to do?
<div th:text="${viewModel.yourDescriptiveMethod()}">placeholder</div>
public class ViewModel {
private final @NonNull YourService service;
public boolean yourDescriptiveMethod() {
return service.someMethod()
// … more methods
class YourController {
private final YourService service;
// Available in all views rendered by that controller
public ViewModel viewModel() {
return new ViewModel(service);
// … request mappings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment