Constructor argument with object matching
来源:互联网 发布:网络预警包括 编辑:程序博客网 时间:2024/04/30 20:31
web.xml
<bean id="drink" class="com.vf.constructor.objectmatch.Drink"> <constructor-arg ref="alcohol" /></bean> <bean id="alcohol" class="com.vf.constructor.objectmatch.Alcohol"></bean>
DrinkService.java
package com.vf.constructor.objectmatch;public interface DrinkService {}
Alcohol.java
package com.vf.constructor.objectmatch;public class Alcohol implements DrinkService{/** * @param args */public Alcohol() {System.out.println("I like drinking alcohol");}}
Drink .java
package com.vf.constructor.objectmatch;import org.springframework.context.ApplicationContext;import org.springframework.context.support.ClassPathXmlApplicationContext;public class Drink {/** * @param args */private DrinkService service;public Drink(DrinkService service) {this.service = service;}public static void main(String[] args) {ApplicationContext context = new ClassPathXmlApplicationContext("web.xml");context.getBean("drink", Drink.class);}}
I like drinking alcohol
- Constructor argument with object matching
- Constructor argument type matching
- Constructor argument name
- object.constructor
- Object.constructor
- Error creating bean with name 'amqpTemple' Could not resolve matching constructor (hint: specify
- 再谈 object instanceof constructor
- class has no zero argument constructor
- Less的guards and argument matching
- JavaScript:Object.constructor == Object.prototype.constructor 返回 false
- String matching with simmetrics
- C++ Object Model: Default Constructor
- Python decorator class with argument
- Test class should have public zero-argument constructor 解决办法
- cannot create inner bean while setting constructor argument
- 【LeetCode with Python】 Wildcard Matching
- SIFT(ASIFT) Matching with RANSAC
- SIFT(ASIFT) Matching with RANSAC
- tomcat中server.xml属性详解
- apache和apache tomcat的关系
- UILabel 自动换行--
- svnsync 同步
- Fortran产生批量文件名
- Constructor argument with object matching
- ios KVO机制的认识
- NSUserDefaults读取和写入自定义对象
- 命令行下FTP 命令下载执行文件
- dll文件与模态和费模态对话框的建立
- GSL--GNU Scientific Library
- 时光荏苒我自孤清!
- 互斥与并发(1)硬件支持
- MAINFEST.MF