1、如何学习spring?
你可以通过下列途径学习spring:
(1) spring下载包中doc目录下的mvc-step-by-step和sample目录下的例子都是比较好的spring开发的例子。
(2) appfuse集成了目前最流行的几个开源轻量级框架或者工具 ant,xdoclet,spring,hibernate(ibatis),junit,cactus,strutstestcase,canoo's webtest,struts menu,display tag library,oscache,jstl,struts 。
你可以通过appfuse源代码来学习spring。
appfuse网站:http://raibledesigns.com/wiki/wiki.jsp?page=appfuse
(3)spring 开发指南(夏昕)(http://www.xiaxin.net/spring_dev_guide.rar)
一本spring的入门书籍,里面介绍了反转控制和依赖注射的概念,以及spring的bean管理,spring的mvc,spring和hibernte,ibatis的结合。
(4) spring学习的中文论坛
springframework中文论坛(http://spring.jactiongroup.net)
java视线论坛(http://forum.javaeye.com)的spring栏目
2、利用spring框架编程,console打印出log4j:warn please initialize the log4j system properly?
说明你的log4j.properties没有配置。请把log4j.properties放到工程的classpath中,eclipse的classpath为bin目录,由于编译后src目录下的文件会拷贝到bin目录下,所以你可以把log4j.properties放到src目录下。
这里给出一个log4j.properties的例子:
| log4j.rootlogger=debug,stdout log4j.appender.stdout=org.apache.log4j.consoleappender log4j.appender.stdout.layout=org.apache.log4j.patternlayout log4j.appender.stdout.layout.conversionpattern=%d %5p (%f:%l) - %m%n |
| <bean id="sessionfactory" class="org.springframework.orm.hibernate.localsessionfactorybean"> <property name="datasource"><ref bean="datasource"/></property> <property name="mappingresources"> <list> <value>user.hbm.xml</value> 错,改为: <value>com/yz/spring/domain/user.hbm.xml</value> </list> </property> <property name="hibernateproperties"> <props> <prop key="hibernate.dialect">.net.sf.hibernate.dialect.mysqldialect </prop> <prop key="hibernate.show_sql">true</prop> </props> </property> </bean> |
| public class postmanageimpl extends basemanage implements postmanage { private postdao dao = null; public void setpostdao(postdao postdao){ this.dao = postdao; } } |
| <bean id="postmanage" parent="txproxytemplate"> <property name="target"> <bean class="com.yz.spring.service.implement.postmanageimpl"> <property name="postdao"><ref bean="postdao"/></property> 对 <property name="dao"><ref bean="postdao"/></property> 错 </bean> </property> </bean> |
| <bean id="txproxytemplate" abstract="true" class="org.springframework.transaction.interceptor.transactionproxyfactorybean"> <property name="transactionmanager"><ref bean="transactionmanager"/></property> <property name="transactionattributes"> <props> <prop key="save*">propagation_required</prop> <prop key="remove*">propagation_required</prop> <prop key="*">propagation_required</prop> </props> </property> </bean> <bean id="usermanage" parent="txproxytemplate"> <property name="target"> <bean class="com.yz.spring.service.implement.usermanageimpl"> <property name="userdao"><ref bean="userdao"/></property> </bean> </property> </bean> |
| string[] paths = {"com/yz/spring/dao/hibernate/applicationcontext-hibernate.xml", "com/yz/spring/service/applicationcontext-service.xml"}; ctx = new classpathxmlapplicationcontext(paths); |
| <servlet> <servlet-name>context</servlet-name> <servlet-class>org.springframework.web.context.contextloaderservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <context-param> <param-name>contextconfiglocation</param-name> <param-value>/web-inf/applicationcontext-hibernate.xml</param-value> <param-value>/web-inf/applicationcontext-service.xml</param-value> </context-param> |
| <context-param> <param-name>log4jconfiglocation</param-name> <param-value>/web-inf/log4j.properties</param-value> </context-param> |
| expert one on one j2ee design and development expert one on one j2ee development without ejb |
| http://www.martinfowler.com/articles/injection.html |
| http://www.jactiongroup.net/reference/html/index.html(中文版,未全部翻译) |
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器