【发布时间】:2011-09-16 11:32:28
【问题描述】:
很抱歉标题太长了,但我不知道有什么具体的方法。
我有什么:
我正在开发一个审计跟踪模块,它使用 Hibernate 拦截器来拦截 Hibernate 调用并添加审计日志条目。这很好用。
我的 Web 应用程序使用 Struts2 和 Spring。我的 Hibernate 拦截器可以访问 Spring 的 ApplicationContext。
我想要什么:
因为我想为每个审计日志条目“赋予意义”,所以我需要将在表示层 (Struts) 发出的每个请求的参数(例如字符串消息)传递给 Spring 的 ApplicationContext。这样,我可以访问 Hibernate Interceptor 中的参数并相应地记录它。
示例:
- Struts - 用户详细信息页面:setPassword(user1, mypass),生成一个 新消息“用户 1 更改了他/她的密码”。
- 此消息被注入到 Spring 的 ApplicationContext 中。
- Hibernate Interceptor 拦截“更新”并从 Spring 的 ApplicationContext 获取上一条消息,并使用该消息创建一个新的日志条目。
你知道怎么做吗?
【问题讨论】:
标签: spring hibernate struts2 interceptor applicationcontext