1. How to learn Spring?
You can learn Spring through the following ways:
(1) The example in the MVC-STEP-BY-STEP and SAMPLE directory in the Spring Directory is a preferred Spring development.
(2) AppFuse integrates the current most popular lightweight lightweight framework or tools Ant, XDoclet, Spring, Hibernate (Ibatis), Junit, Cactus, Strutstestcase, Canoo's WebTest, Struts Menu, Display Tag Library, OSCache, JSTL, Struts.
You can learn Spring through the AppFuse source code.
Appfuse website: http://raibledesigns.com/wiki/wiki.jsp? Page = Appfuse
(3) Spring Development Guide (Xia Zhen) (http://www.xiaxin.net/spring_dev_guide.rar)
A Spring entry book, introduces the concept of reverse control and relying on injection, as well as Spring Bean Management, Spring MVC, Spring, and Hibernte, IBATIS.
(4) Spring learning Chinese forum
Springframework Chinese Forum (http://spring.jctiongroup.net)
Spring section of the Java Line Forum (http://forum.javaeye.com)
2, use the Spring framework programming, console prints Log4J: WARN PLEASE INITIALIZE THE LOG4J SYSTEM PROPERLY?
Explain that your log4j.properties is not configured. Please put the log4j.properties in the ClassPath of the project, Eclipse's classpath is a bin directory, so you can put the log4j.properties in the SRC directory because the files in the SRC directory are copied to the bin directory.
Here is an example of log4j.properties:
log4j.rootLogger = DEBUG, stdoutlog4j.appender.stdout = org.apache.log4j.ConsoleAppenderlog4j.appender.stdout.layout = org.apache.log4j.PatternLayoutlog4j.appender.stdout.layout.ConversionPattern =% d% 5p (% F: % L) -% M% N
3, appear java.lang.noclassdefounderror?
In general, since you didn't put the necessary JAR packages into the lib.
For example, you have to use Spring and Hibernate, you need hibernat.jar, aopalliance.jar, cglig.jar, Jakarta-Commons, in addition to Spring.jar.
Http://www.springframework.org/download.html Download Spring Development Pack, two ZIP packages
Spring-framework-1.1.3-with-dependencies.zip and Spring-framework-1.1.3.zip, I suggest you download Spring-deramework 1.1.3-with-dependencies.zip. This zip decompression is more than one lib directory than the latter, where Hibernate, J2EE, DOM4J, AOPALLIANCE, JAKARTA-Commons, etc. are common packages.
4, java.io.filenotfoundexception: could not open class path resource [.... hbm.xml], prompt not to find an XML file? The reason is generally two:
(1) The XML file is not in the ClassPath.
(2) The XML name in ApplicationContext-Hibernate.xml does not have a package name. such as:
such as
Public class postmanageImpl Extends BaseManage Implements PostManage {Private PostDao DAO = NULL; Public Void SetPostdao (POSTDAO POSTDAO) {THIS.DAO = posketdao;}}
Then the definition of XML should be:
First, if you use mysql, determine MySQL to the InnoDB type.
The control of transaction management should be placed in the business logic layer. You can write a JavaBean that handles business logic, call DAO in the JavaBean, then incorporate the BEAN's method into Spring's transaction management.
For example, the XML file is defined as follows:
7. How do I manage more Javabean under the Spring framework?
The more javabean, the greater the Spring configuration file, which is not easy to maintain. In order to make the configuration clear, we can manage the JavaBean to manage, placed in different profiles. Load all XML simultaneously when the application starts.
such as:
JavaBean in the DAO layer is placed in ApplicationContext-Hibernate.xml, and the JavaBean of the business logic layer is placed in ApplicationContext-Service.xml. Then, the startup class is called to load all ApplicationContext.
String [] paths = { "com / yz / spring / dao / hibernate / applicationContext-hibernate.xml", "com / yz / spring / service / applicationContext-service.xml"}; ctx = new ClassPathXmlApplicationContext (paths);
8. How do I load ApplicationContext in web applications?
You can automatically load by defining web.xml.
9, how is the log4j configured in Spring?
Add the following code to Web.xml.
10, Spring framework introduced programming problem solved, how should I understand the Spring framework?
These two books you should go see. These two books were written by Spring author rod johnson.
Expert One ON One J2EE Design and Developmentexpert One ON One J2EE Developments WITHOUT EJB
You should also look at Martinfowler's Inversion of Control Containers and The Dependency Injection Pattern.
http://www.martinfowler.com/articles/injection.html
A further study Spring documentation.
Http://www.jactiongroup.net/reference/html/index.html (Chinese version, unfinished translation)
There is also more practice.