org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.klzy.tnt.bean.host.Pif': Unsatisfied dependency expressed through constructor argument with index 0 of type [java.lang.Short]: : No unique bean of type [java.lang.Short] is defined: Unsatisfied dependency of type [class java.lang.Short]: expected at least 1 matching bean; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [java.lang.Short] is defined: Unsatisfied dependency of type [class java.lang.Short]: expected at least 1 matching bean
这个是哪里出的问题?

解决方案 »

  1.   

    异常说是你的'com.klzy.tnt.bean.host.Pif这个有问题
    仔细检查你的配置文件及实体类映射文件!应该是那里面的问题!~
      

  2.   

    PIF类
         private Integer ifid;
         private short idx;
         private int piftypeid;
      //set get和构造都有
    配置文件
     <class name="com.klzy.tnt.bean.host.Pif" table="pif" catalog="mydb">
            <id name="ifid" type="java.lang.Integer">
                <column name="ifid" />
                <generator class="assigned" />
            </id>
            <property name="idx" type="java.lang.Short">
                <column name="idx" />
            </property>
            <property name="piftypeid" type="java.lang.Integer">
                <column name="piftypeid" />
            </property>
        </class>
    数据表
    /*==============================================================*/
    /* Table: pif                                                   */
    /*==============================================================*/
    create table pif
    (
       ifid                 int not null,
       piftypeid            int comment '引用piftype表的id表示网卡的类型
                ',
       idx                  tinyint
    );
      

  3.   

    <property name="idx" type="short">
      <column name="idx" />
      </property>
    ---改成常规short类型再试
      

  4.   

    谢谢,问题不在那,tinyint映射成byte类型应该
      

  5.   

    tinyint是可以映射成short类型的
    应该是你的PIF类出的问题
    贴全部代码出来看看