in AppModule.java
public static void contributeApplicationDefaults(
MappedConfiguration<String, String> configuration)
{
configuration.add("tutor.file-system-root", "/Users/pbeshai/tmproot/");
configuration.add("tapestry.supported-locales", "en");
configuration.add("tapestry.start-page-name", "Login");
}
And hopefully be able to inject that value into components where
necessary. Is there a more advised way of doing this?
Unfortunately, I am unable to retrieve this value in my component
(from simple lack of know-how).
I thought it might be similar to
@Inject
@Value("${tutor.file-system-root}")
private String _fileSystemRoot;
public String getFileSystemRoot() { return _fileSystemRoot; }
定义系统公用变量方法
Tapestry配置注入实践
最新推荐文章于 2022-02-18 19:32:01 发布
本文探讨了在Tapestry框架中如何通过AppModule进行默认配置的设置,并尝试将这些配置值注入到组件中以便使用。同时,提出了当前实现方式中存在的问题及寻求更佳实践方案。
3077

被折叠的 条评论
为什么被折叠?



