001package io.jstach.opt.spring.example.message; 002 003import org.springframework.context.annotation.Bean; 004import org.springframework.context.annotation.Configuration; 005 006import io.jstach.opt.spring.webmvc.JStachioModelViewConfigurer; 007 008/** 009 * Message wiring. 010 * 011 * @author agent 012 * 013 */ 014@Configuration 015public class MessageConfiguration { 016 017 /** 018 * Created by Spring 019 */ 020 public MessageConfiguration() { 021 } 022 023 /** 024 * Bean to create configurer bean that does cross cutting logic across controllers 025 * @return configurer 026 */ 027 @Bean 028 public JStachioModelViewConfigurer configurer() { 029 return (page, model, request) -> { 030 if (page instanceof MessagePage message) { 031 message.message = "Hello configured!"; 032 } 033 }; 034 } 035 036}