001package io.jstach.opt.spring.webflux.example.message;
002
003import org.springframework.context.annotation.Bean;
004import org.springframework.context.annotation.Configuration;
005
006import io.jstach.opt.spring.webflux.JStachioModelViewConfigurer;
007
008/**
009 *
010 * Spring configuration to add a {@link JStachioModelViewConfigurer} for MessagePage.
011 *
012 * @author dsyer
013 *
014 */
015@Configuration
016public class MessageConfiguration {
017
018        /**
019         * Called by Spring
020         */
021        public MessageConfiguration() {
022        }
023
024        /**
025         * Creates the configurer for Spring
026         * @return configuer specific to Message
027         */
028        @Bean
029        public JStachioModelViewConfigurer configurer() {
030                return (page, model, request) -> {
031                        if (page instanceof MessagePage message) {
032                                message.message = "Hello configured!";
033                        }
034                };
035        }
036
037}