1. 程式人生 > >淺談spring框架(一)

淺談spring框架(一)

spring是一個非常活躍的開源框架,他是一個基於core來架構的多層JavaEE的框架,他的主要目的是簡化企業級開發。

使用spring框架,需要用到spring框架的核心jar包,需要的話,這是連結http://pan.baidu.com/s/1cd9DHs

spring的配置檔案有固定的的名字:applicationContext.xml

這是配置檔案的xsd檔案

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
</beans>

也可以建立多個配置檔案,在總的配置檔案裡面匯入一下也行:<import resource="com/cal/spring/sh/createobject/method/applicationContext-createobject-method.xml"/>

也可以給配置檔案裡面的方法自定義一個名字。例如:<alias name="helloWorld_Allas" alias="king"/>但是這裡的name要和上面的id一樣,否則解析xml檔案是時會報錯。