摘要:
1.@Resource(重要)a)加入 :j2ee/common-annotations.jar b)默认按名称,名称找不到,按类型默认按照名称setName1到xml中找和id相同的,没有的话再找和SetName类型一样的public class HelloWorld { SetName s... 阅读全文
摘要:
自动装配:按照类型来找会在xml中找类型一样的,比如 setMessage(SetName setName)上面有@Autowired,会到xml中找package com.yibai;import org.springframework.beans.factory.annotation.Autow... 阅读全文
摘要:
@Required注解适用于bean属性的setter方法,使用@Required的方法必须在xml中填充,负责报错例如下面的例子中,student中的setAge和setName有@Required注解如果xml中没有使用就会报错,package com.crm;import org.spring... 阅读全文