Grails Resources.groovy 构造函数注入
来源:互联网 发布:猎场删减 知乎 编辑:程序博客网 时间:2024/05/21 11:17
Consider these classes...
src/java/com/example/SomeClass.java
package com.example;
public class SomeClass {
public SomeClass(java.util.List<SomeOtherClass> soc) {
}
}
src/java/com/example/SomeOtherClass.java
package com.example;
public class SomeOtherClass {
public SomeOtherClass(java.io.File f) {
}
}
In the Spring Bean Builder you can wire those up using something like this...
grails-app/conf/resources.groovy
beans = {
xmlns util:"http://www.springframework.org/schema/util"
someotherbean(com.example.SomeOtherClass, new File('somefile.txt'))
someotherbean2(com.example.SomeOtherClass, new File('somefile.txt'))
util.list(id: 'mybeans'){
ref(bean:'someotherbean')
ref(bean:'someotherbean2')
}
somebean(com.example.SomeClass, ref('mybeans') )
}
It would be better if you could do something like this...
grails-app/conf/resources.groovy
beans = {
someotherbean(com.example.SomeOtherClass, new File('somefile.txt'))
someotherbean2(com.example.SomeOtherClass, new File('somefile.txt'))
somebean(com.example.SomeClass, [someotherbean, someotherbean2])
}
- Grails Resources.groovy 构造函数注入
- Groovy&Grails
- Groovy&Grails
- 开始接触Groovy & Grails
- Groovy和Grails简介
- Groovy On Grails
- Groovy和Grails简介
- Groovy&Grails经验
- Groovy& Grails学习纪录
- Groovy和Grails简介
- Groovy和Grails简介
- grails datasource.groovy
- grails、groovy创建xml
- grails调用groovy脚本
- Spring 构造函数注入
- spring 构造函数注入
- spring 构造函数注入
- Groovy和Grails安装配置
- 君子爱财,取之有道
- 常用网站
- 给想骗我的人说几句话
- Web Service快速入门了解
- POJ 2528 Mayor's posters(离散化+线段树)
- Grails Resources.groovy 构造函数注入
- Poj-2299 [用归并排序求逆序数的个数]
- Web service 开发
- 新建文章1
- 收藏夹导入:sogou to IE
- 人在杭州
- String对象的创建
- 路由环路的产生及解决
- 笔试题