How to Learn Spring

Source: Internet
Author: User
Tags log4j

1. How to learn Spring?
You can learn spring in the following ways:
(1) examples in the MVC-step-by-step and sample directories under the doc directory in the spring download package are good examples of spring development.

(2) AppFuse integrates several of the most popular open source lightweight frameworks or tools Ant, XDoclet, Spring, Hibernate (iBATIS), JUnit, Cactus, StrutsTestCase, Canoo's WebTest, struts Menu, Display Tag Library, OSCache, JSTL, and Struts.
You can use the source code of AppFuse to learn spring.
AppFuse website: http://raibledesigns.com/wiki/Wiki.jsp? Page = AppFuse

(3) Spring Development Guide (Xia Xin) (http://www.xiaxin.net/Spring_Dev_Guide.rar)
A spring entry book that introduces the concepts of reverse control and dependency injection, spring bean management, spring MVC, spring, hibernte, and iBatis.

(4) Chinese forum for spring learning
SpringFramework Chinese Forum (http://spring.jactiongroup.net)
Java line of sight Forum (http://forum.javaeye.com) spring topic

2. Using Spring Framework programming, the console prints log4j: WARN Please initialize the log4j system properly?
It indicates that your log4j. properties is not configured. Set log4j. properties is placed in the classpath of the project, and the classpath of eclipse is the bin directory. Since the files under the src directory will be copied to the bin directory after compilation, you can set log4j. put properties in the src directory.
Here is an example of log4j. properties:

Log4j. rootLogger = DEBUG, stdout
Log4j. appender. stdout = org. apache. log4j. Leleappender
Log4j. appender. stdout. layout = org. apache. log4j. PatternLayout
Log4j. appender. stdout. layout. ConversionPattern = % d % 5 p (% F: % L)-% m % n


3. Why does java. lang. NoClassDefFoundError appear?
Generally, it is because you have not put the necessary jar package into lib.

For example, if you want to use spring and hibernate (with transaction support), except spring. hibernat is also required in addition to jar. jar, aopalliance. jar, cglig. jar and several jar packages under jakarta-commons.

Http://www.springframework.org/download.htmldownload spring development kit, two zips
. This zip package has an additional lib directory than the latter, including common packages such as hibernate, j2ee, dom4j, aopalliance, and jakarta-commons.


4. java. io. FileNotFoundException: cocould not open class path resource [... hbm. xml]. Why can't I find the xml file?
There are generally two reasons:
(1) the xml file is not in classpath.
(2) the xml name in the applicationContext-hibernate.xml does not contain the package name. For example:
<Bean id = "sessionFactory" class = "org. springframework. orm. hibernate. LocalSessionFactoryBean">
<Property name = "dataSource"> <ref bean = "dataSource"/> </property>
 &

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.