Stripes注解官方释义

Stripes框架核心注解
本文介绍了Stripes Web应用框架中的三个关键注解:@SessionScope用于定义会话范围内的ActionBean;@SpringBean用于注入Spring管理的Bean;@DefaultHandler用于标记默认处理方法。

Stripes是一个视图框架用于利用最新的Java技术来构建Web应用程序.

1.@SessionScope
net.sourceforge.stripes.action.SessionScope
@Target(value={TYPE})
@Retention(value=RUNTIME)
@Documented

Annotation that is used to specify that an ActionBean should be instantiated and stored across requests in the Session scope. By default ActionBeans are instantiated per-request, populated, used and then discarded at the end of the request cycle. Using this annotation causes an ActionBean to live for multiple request cycles. It will be instantiated and put into session on the first request that references the ActionBean. A reference to the bean will also be placed into RequestScope for each request that references the bean, thereby allowing the rest of Stripes to treat it like any other ActionBean.
Since session scope ActionBeans are not generally encouraged by the author, very few allowances will be made in Stripes to accommodate session scope beans. This means that additional mechanisms to handle session scope beans do not exist. However, there are general mechanisms built in to Stripes that will allow you to overcome most if not all issues that arise from Session scoping ActionBeans.

2.@SpringBean
net.sourceforge.stripes.integration.spring.SpringBean
@Target(value={FIELD, METHOD})
@Retention(value=RUNTIME)
@Documented

Annotation used for injecting Spring managed beans into objects within Stripes (usually ActionBeans). The value of the annotation represents the name of the bean in the Spring application context to inject. If the value is omitted then Stripes will attempt to auto-wire first by property/field name and then by type.
Both methods and fields can be annotated. If a field is annotated Stripes will use field access to attempt to inject the bean into the field. If a method is annotated Stripes will attempt to invoke the method and supply it the value to inject. In both cases non-public fields/methods are supported (i.e. values can be injected into private fields and through private methods).


3.@DefaultHandler
net.sourceforge.stripes.action.DefaultHandler
@Target(value={METHOD})
@Retention(value=RUNTIME)
@Documented

Marker annotation to specify that a method within an ActionBean is the default handler for events if a specific event cannot be identified.

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

itzyjr

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值