你能推荐一些门户网站或网站,在那里我可以找到第三版Spring的好例子(或教程,截屏视频)吗?
P.S。我是Spring的初学者(在java web-frameworks中)。现在我选择要学习的Spring版本(2.5到3之间)。哪一个最适合我?
答案 0 :(得分:3)
答案 1 :(得分:2)
http://www.vaannila.com/spring/spring-example/spring-example.html 我希望这会对你有所帮助....在你完成这个之前你必须先了解一些关于春天的基础知识我先给出一个示例程序你才能理解春天的流程。
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
class computer {
private String keyBoard;
public void setKeyBoard(String keyBoard) {
this.keyBoard = keyBoard;
}
public String getKeyBoard() {
return keyBoard;
}
}
public class A {
public static void main(String...args) {
BeanFactory factory = new XmlBeanFactory(new ClassPathResource("computer.xml"));
computer comp = (computer)factory.getBean("keyboard");
System.out.println(comp.getKeyBoard());
}
}
的context.xml
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="keyboard" class="computer">
<property name="keyBoard" value="Dell"/>
</bean>
批处理文件执行程序
cls
set CLASSPATH=.;E:\SpringPrograms\lib\commons-logging.jar;E:\SpringPrograms\lib\org.springframework.aop-3.0.2.RELEASE.jar;E:\SpringPrograms\lib\org.springframework.asm-3.0.2.RELEASE.jar;E:\SpringPrograms\lib\org.springframework.aspects-3.0.2.RELEASE.jar;E:\SpringPrograms\lib\org.springframework.beans-3.0.2.RELEASE.jar;E:\SpringPrograms\lib\org.springframework.context-3.0.2.RELEASE.jar;E:\SpringPrograms\lib\org.springframework.context.support-3.0.2.RELEASE.jar;E:\SpringPrograms\lib\org.springframework.core-3.0.2.RELEASE.jar;E:\SpringPrograms\lib\org.springframework.expression-3.0.2.RELEASE.jar;E:\SpringPrograms\lib\org.springframework.instrument-3.0.2.RELEASE.jar;E:\SpringPrograms\lib\org.springframework.instrument.tomcat-3.0.2.RELEASE.jar;E:\SpringPrograms\lib\org.springframework.jdbc-3.0.2.RELEASE.jar;E:\SpringPrograms\lib\org.springframework.jms-3.0.2.RELEASE.jar;E:\SpringPrograms\lib\org.springframework.orm-3.0.2.RELEASE.jar;E:\SpringPrograms\lib\org.springframework.oxm-3.0.2.RELEASE.jar;E:\SpringPrograms\lib\org.springframework.test-3.0.2.RELEASE.jar;E:\SpringPrograms\lib\org.springframework.transaction-3.0.2.RELEASE.jar;E:\SpringPrograms\lib\org.springframework.web-3.0.2.RELEASE.jar;E:\SpringPrograms\lib\org.springframework.web.portlet-3.0.2.RELEASE.jar;E:\SpringPrograms\lib\org.springframework.web.servlet-3.0.2.RELEASE.jar;E:\SpringPrograms\lib\org.springframework.web.struts-3.0.2.RELEASE.jar;
javac A.java
java A