Setting model attributes for every action within each controller
问题 I would like to set three common attributes on my model for each @RequestMapping within the many controllers in a Spring Boot application. I have read about @ModelAttribute but it needs to be placed within each Controller. I have more than 20 controllers in my application and each having more than 10 @RequestMapping . Is there a way to set such model attributes in one place which gets initialized at the start of the application? 回答1: If you want to execute some code on Spring Boot startup,