使用Aspect将响应标题添加到所有控制器
我希望我所有的Spring MVC控制器都包含一些常见的响应头文件。
我可以使用以下(Kotlin)做到这一点:
@ModelAttribute open fun responseHeaders(response: HttpServletResponse) { //identify the node that serviced the call response.setHeader("host-name", InetAddress.getLocalHost().hostName); //etc }
。 。 因为它适用于所有,我可以使用基类。 但是,有没有建议的方式来使用一个方面?
- 如何使用X-Pack身份验证为Spring Data Elasticsearch v 3.0.0.M4创建application.yml文件?
- Firebase Perf不会运行测试应用程序:transformClassesWithFirebasePerformancePluginForDebugAndroidTest
- 使用kotlin-spring插件,还是得不到类的打开错误
- Spring 5和Kotlin 1.1协程:类型rx.Scheduler不存在
- IntelliJ社区找不到Web应用程序工件来生成WAR
- Spring Data JPA + Guice错误:使用@EnableTransactionManagement注解时,没有类型的主要bean定义
- Spring使用OAuth令牌进行社交登录
- Spring Boot 2&Spring 5错误服务index.html
- Java vs Kotlin – 同一个类中的Spring @Async方法
- 为什么@Primary有时候不适用于Kotlin类?
- 异常处理程序不能使用`spring-boot-starter-data-rest`