Tapestry5的注解之@Inject

摘要:
@InjectTapestry5中有许多有用的注释。今天,我们记录了一些@Inject相关的内容。注入Tapestry使依赖关系(如资源、资产、组件、块或服务)在应用程序、组件、混合或服务类中可用。注入是Tapestr

@Inject

Tapestry5中有好多个有用的注解,今天记录些@Inject相关的东西。

Injection is Tapestry's way of making a dependency – such as a resource, asset, component, block or service – available in a page, component, mixin or service class.

Injection是Tapestry中定义从属关系的方式 - 例如,resource, asset, component, block or service - 在page,component,mixin或者服务类中都可以定义。

胡乱翻译的。

1 Block Injection 插入一个块儿。。。

@Inject
private Block foo; //默认id为foo的

或者
@Inject @Id(
"bar") private Block barBlock; //id已经被指定

2 Resource Injection 资源插入

  • java.util.Locale – The locale for the component (all components within a page use the same locale).
  • org.slf4j.Logger – A Logger instance configured for the component, based on the component's class name. SLF4J is a wrapper around Log4J or other logging toolkits.
  • org.apache.tapestry5.ComponentResources – The resources for the component, often used to generate links related to the component.
  • org.apache.tapestry5.ioc.Messages – The component message catalog for the component, from which localized messages can be generated.
@Inject
private ComponentResources resources;

3 Asset Injection class或者src什么的

@Inject
@Path("context:images/top_banner.png")
private Asset banner;

4 Service Injection

这个比较普遍。。。

5 Request Injection

这个目前只见过,request.isXHR() ? someZone.getBody() : null;这一种情况。。。

免责声明:文章转载自《Tapestry5的注解之@Inject》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇【原创】主机不能访问虚拟机CentOS7中的站点Go语言学习--包下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

随便看看

OpenFaceswap 入门教程(1):软件安装篇

---内容恢复的开始-在许多改变面貌的软件中,DeepFaceLab实际上是安装和使用最方便、更新最快的。然而,由于缺乏可扩展的界面,初学者可能很难入门。因此,今天我们将介绍OpenFaceSwap,一个非常直观和简单的换脸软件。该软件的安装和使用体验与Fakeap类似,但软件内核是“高级”的,因为Fakeap已经停止了很长时间,而OpenFaceSwap内...

kernel: blk_update_request: I/O error, dev fd0, sector 0

检查后,控制台无法登录。重新启动虚拟机,报告下图,然后执行journalctl以显示以下系统消息日志原因搜索。。。...

flutter vscode+第三方安卓模拟器

1.首先打开夜曲模拟器2.Win+R,选择cmd,在第三方模拟器安装目录的bin目录下输入夜曲模拟器,然后运行命令:nox_Adb.execonnect127.0.0.1:620013。打开项目终端的vscode并建立连接:adbconnect127.00.1:62001(夜神模拟器的默认端口)4。查看连接:adbdevices或不使用第三方模拟器:1.打开...

Maven settings.xml配置详解

让我们来谈谈设置。对于Maven,xml相当于全局配置,用于所有项目。maven2-xml中有两个设置,作为全局配置位于maven2的安装目录conf下。对于团队设置,一致的定义是关键,因此maven2/conf Xml下面的设置是团队的通用配置文件。当然,每个成员都需要特殊的用户定义设置,例如用户信息,其他设置也是如此。xml用作本地配置。默认位置为:${...

一些替代Xshell的软件推荐

TransmitTransmit是一个30美元价格的共享软件,它覆盖了几乎所有的常用功能,包括远程文件编辑和文件夹同步,尽管其有30美元的价格,很多Windows用户也希望Transmit能出一个Win版的。FireFTPFireFTP是一个Firefox扩展,能直接集成一个强大的FTP客户端到我们最喜爱的浏览器Firefox上。CyberduckCyber...

IntelliJ IDEA 2020.1 激活教程,亲测可用

二、IDEA2020.1破解版破解支持windows2.1、下载正版的安装下载地址https://www.jetbrains.com/idea/download,2.2、下载破解程序关注公众号:知识追寻者后台回复idea领取破解包2.3、破解过程弹出注册界面,选择evaluateforfree,点击evaluate试用软件;将jetbrains-agent....