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 |
錛渂ean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean"錛?BR>錛減roperty name="dataSource"錛烇紲ref bean="dataSource"/錛烇紲/property錛?BR>錛減roperty name="mappingResources"錛?BR>銆錛渓ist錛?BR>銆銆錛渧alue錛濽ser.hbm.xml錛?value錛?BR>銆銆閿欙紝鏀逛負(fù)錛? 銆銆錛渧alue錛瀋om/yz/spring/domain/User.hbm.xml錛?value錛?BR>銆錛?list錛?BR>錛?property錛?BR>錛減roperty name="hibernateProperties"錛?BR>錛減rops錛? 銆錛減rop key="hibernate.dialect"錛?net.sf.hibernate.dialect.MySQLDialect 錛?prop錛? 銆錛減rop key="hibernate.show_sql"錛瀟rue錛?prop錛? 錛?props錛? 錛?property錛?BR>錛?bean錛?/FONT> |
public class PostManageImpl extends BaseManage implements PostManage { 銆private PostDAO dao = null; 銆public void setPostDAO(PostDAO postDAO){ 銆銆this.dao = postDAO; 銆} } |
錛渂ean id="postManage" parent="txProxyTemplate"錛?BR>錛減roperty name="target"錛?BR>銆錛渂ean class="com.yz.spring.service.implement.PostManageImpl"錛?BR>銆銆錛減roperty name="postDAO"錛烇紲ref bean="postDAO"/錛烇紲/property錛?瀵?BR>銆銆錛減roperty name="dao"錛烇紲ref bean="postDAO"/錛烇紲/property錛?閿?BR>銆錛?bean錛?BR>錛?property錛?BR>錛?bean錛?/FONT> |
錛渂ean id="txProxyTemplate" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"錛?BR>錛減roperty name="transactionManager"錛烇紲ref bean="transactionManager"/錛烇紲/property錛?BR>錛減roperty name="transactionAttributes"錛?BR>錛減rops錛?BR>錛減rop key="save*"錛濸ROPAGATION_REQUIRED錛?prop錛?BR>錛減rop key="remove*"錛濸ROPAGATION_REQUIRED錛?prop錛?BR>錛減rop key="*"錛濸ROPAGATION_REQUIRED錛?prop錛?BR>錛?props錛?BR>錛?property錛?BR>錛?bean錛?BR> 錛渂ean id="userManage" parent="txProxyTemplate"錛?BR>銆錛減roperty name="target"錛?BR>銆銆錛渂ean class="com.yz.spring.service.implement.UserManageImpl"錛?BR>銆銆銆錛減roperty name="userDAO"錛烇紲ref bean="userDAO"/錛烇紲/property錛?BR>銆銆錛?bean錛?BR>銆錛?property錛?BR>錛?bean錛?/FONT> |
String[] paths = {"com/yz/spring/dao/hibernate/applicationContext-hibernate.xml", "com/yz/spring/service/applicationContext-service.xml"}; ctx = new ClassPathXmlApplicationContext(paths); |
錛渟ervlet錛?BR>錛渟ervlet-name錛瀋ontext錛?servlet-name錛?BR>錛渟ervlet-class錛瀘rg.springframework.web.context.ContextLoaderServlet錛?servlet-class錛?BR>錛渓oad-on-startup錛?錛?load-on-startup錛?BR>錛?servlet錛?BR> 錛渃ontext-param錛?BR>錛減aram-name錛瀋ontextConfigLocation錛?param-name錛?BR>錛減aram-value錛?WEB-INF/applicationContext-hibernate.xml錛?param-value錛?BR>錛減aram-value錛?WEB-INF/applicationContext-service.xml錛?param-value錛?BR>錛?context-param錛?/FONT> |
錛渃ontext-param錛?BR>錛減aram-name錛瀕og4jConfigLocation錛?param-name錛?BR>錛減aram-value錛?WEB-INF/log4j.properties錛?param-value錛?BR>錛?context-param錛?/FONT> |
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錛堜腑鏂囩増錛屾湭鍏ㄩ儴緲昏瘧錛?/FONT> |