刚学spring就遇到一个问题,哪位帮忙解决一下

我通过构造器注入,并且给构造参数指定了类型,但是运行时报错。
代码:
[code="java"]package com.alpha.spring.ch4;

import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.FileSystemResource;

public class ConstructorConfusion {
private String message;
public ConstructorConfusion(String message, int number) {
System.out.println("ConstructorConfusion(String message, int number) is called");
this.message = message + Integer.toString(number);
}
public String toString() {
return message;
}
public static void main(String[] args) {
XmlBeanFactory factory = new XmlBeanFactory(new FileSystemResource("applicationContext.xml"));
ConstructorConfusion cc = (ConstructorConfusion)factory.getBean("constructorConfusion");
System.out.println(cc);
}
}
[/code]
xml配置文件:
[code="java"]<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">





hello world



20


[/code]
运行代码时控制台输出如下错误信息:
[code="java"]log4j:WARN No appenders could be found for logger (org.springframework.core.CollectionFactory).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'constructorConfusion' defined in file [E:\test_workspace\spring\applicationContext.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [java.lang.String]: Ambiguous constructor argument types - did you specify the correct bean references as constructor arguments?
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createArgumentArray(AbstractAutowireCapableBeanFactory.java:796)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:673)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:358)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:233)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:145)
at com.alpha.spring.ch4.ConstructorConfusion.main(ConstructorConfusion.java:17)
[/code]
哪位请告诉我哪里不对?

1, String加上包名:
[code="java"]


hello world


20


[/code]

2, 指定了index可以直接把type去掉
[code="java"]


hello world


20


[/code]

[flash=200,200][flash=200,200][flash=200,200][flash=200,200][flash=200,200][flash=200,200][code="java"][code="java"][code="java"][code="java"][code="java"][code="java"][code="java"][list]
[*][list]
[*][*][list]
[*][*][*][img][img][img][img][img][url][url][url][url][url][flash=200,200][flash=200,200][flash=200,200][flash=200,200][url][url][img][img][img][list]
[*][*][*][*][list]
[*][*][*][*][*][list]
[*][*][*][*][*][*][code="java"][code="java"][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/quote][/code][/code]
[*][*][*][*][*][/list]
[*][*][*][*][/list]
[*][*][*][/list][/img][/img][/img][/url][/url][/flash][/flash][/flash][/flash][/url][/url][/url][/url][/url][/img][/img][/img][/img][/img]
[*][*][/list]
[*][/list]
[/list][/code][/code][/code][/code][/code][/code][/code][/flash][/flash][/flash][/flash][/flash][/flash]

[code="javascript"]alert('test.');[/code]