---
title: "spring3.0      配置依赖"
author: "X_boy"
date: "2011-09-16T14:38:50Z"
tags: []
categories: ["编程语言"]
slug: "spring3-0"
draft: false
lastmod: "2011-09-16T15:02:50Z"
id: 1173455
url: "https://x-boy.iteye.com/blog/1173455"
---

**根据注入的方式不同，Bean的依赖注入通常表现为如下两种形式：**

**1.属性：通过&lt;property.../&gt;元素配置，对应设值注入。**

                 **注：使用设值注入必须有setter方法**

**2.构造器参数：通过&lt;constructor-arg.../&gt;元素指定，对应构造注入。**