使用maven来配置jar包是比较方便的,一般可以从maven的中心库进行搜索,地址是
http://search.maven.org/#browse,这里面内容也非常多,常用的jar包都已经包含了
对于spring来讲,spring也提供了自己对外公布的maven库,地址是:
http://repo.springsource.org/release
在pom.xml中加入:
<repository>
<id>springsource-repo</id>
<name>SpringSource Repository</name>
<url>http://repo.springsource.org/release</url>
</repository>
spring3以后提供的组件非常多,用的时候常常不知道应该配置哪些组件,我们可以打开spring的库里进行查看
Index of release/org/springframework
Name Last modified Size
../
amqp/ 16-May-2012 18:55 -
android/ 30-May-2012 23:01 -
aws/ 27-Nov-2011 18:02 -
batch/ 09-Nov-2011 20:54 -
build/ 14-Nov-2011 09:01 -
commons/ 30-Nov-2011 11:56 -
data/ 20-Feb-2012 11:02 -
flex/ 18-Nov-2011 18:42 -
hateoas/ 19-Jul-2012 11:58 -
integration/ 06-Jan-2012 21:57 -
ldap/ 18-Nov-2011 17:49 -
maven/ 20-Nov-2011 22:56 -
mobile/ 11-May-2012 16:30 -
osgi/ 15-Nov-2011 09:53 -
plugin/ 22-Nov-2012 09:40 -
retry/ 21-Nov-2011 02:47 -
security/ 18-Nov-2011 18:50 -
shell/ 02-Oct-2012 19:13 -
social/ 06-Sep-2012 15:59 -
spring/ 21-Oct-2011 03:46 -
spring-agent/ 21-Oct-2011 03:47 -
spring-aop/ 21-Oct-2011 03:47 -
spring-asm/ 21-Oct-2011 03:47 -
spring-aspects/ 21-Oct-2011 03:47 -
spring-beans/ 21-Oct-2011 03:47 -
spring-binding/ 21-Oct-2011 03:48 -
spring-context/ 21-Oct-2011 03:48 -
spring-context-support/ 21-Oct-2011 03:48 -
spring-core/ 21-Oct-2011 03:30 -
spring-dao/ 21-Oct-2011 03:48 -
spring-expression/ 21-Oct-2011 03:48 -
spring-hibernate2/ 21-Oct-2011 03:48 -
spring-hibernate3/ 21-Oct-2011 03:48 -
spring-ibatis/ 21-Oct-2011 03:48 -
spring-instrument/ 21-Oct-2011 03:48 -
spring-instrument-tomcat/ 21-Oct-2011 03:48 -
spring-integration-tests/ 21-Oct-2011 03:48 -
spring-jca/ 21-Oct-2011 03:48 -
spring-jdbc/ 21-Oct-2011 03:48 -
spring-jdo/ 21-Oct-2011 03:48 -
spring-jms/ 21-Oct-2011 03:49 -
spring-jmx/ 21-Oct-2011 03:49 -
spring-jpa/ 21-Oct-2011 03:49 -
spring-library/ 21-Oct-2011 03:49 -
spring-mock/ 21-Oct-2011 03:49 -
spring-orm/ 21-Oct-2011 03:49 -
spring-oxm/ 21-Oct-2011 03:49 -
spring-parent/ 21-Oct-2011 03:49 -
spring-portlet/ 21-Oct-2011 03:49 -
spring-remoting/ 21-Oct-2011 03:49 -
spring-struts/ 21-Oct-2011 03:49 -
spring-support/ 21-Oct-2011 03:49 -
spring-test/ 21-Oct-2011 03:49 -
spring-tomcat-weaver/ 21-Oct-2011 03:49 -
spring-toplink/ 21-Oct-2011 03:49 -
spring-tx/ 21-Oct-2011 03:49 -
spring-web/ 21-Oct-2011 03:49 -
spring-webflow/ 21-Oct-2011 03:49 -
spring-webmvc/ 21-Oct-2011 03:49 -
spring-webmvc-portlet/ 21-Oct-2011 03:50 -
spring-webmvc-struts/ 21-Oct-2011 03:50 -
webflow/ 27-Mar-2012 18:53 -
ws/ 21-Oct-2011 04:00 -
主要就是这些,通常需要包含spring-core,spring-beans,spring-context等,可以根据需要来进行添加
例如使用spring-context,可以在pom.xml中增加
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.1.3.RELEASE</version>
</dependency>
其他:
一个代码的例子:
https://github.com/SpringSource/spring-sqlfire-samples/tree/master/jpetstore/
可以参考这个例子配置SPRING,这个例子部署在github里,可以不用下载,直接打开看源代码