Spring DAO支持
摘要:Spring提供DAO支持的目的是以一致的方式使用不同的数据库访问技术 Spring把特定于某种技术的一场,如SQLException,转化为自己的异常。这种异常以DataAccessException为根的异常层次。 使用JDBC进行数据访问: Spring至少提供三种不同的工作模式:JdbcTemplate,SimpleJdbc和RDBMS Object风格的面向对象封装方式。 JdbcT...
阅读全文
Spring 事务管理
摘要:事务之间可能存在的三个问题:脏读取,不可重复读取和幻影行 PlatformTransactionManager接口: Spring 事务管理的抽象关键在于PlatformTransactionManager接口的实现,通过依赖与PlatformTansactionManager接口和各种技术的实现,Spring提供开发者使用一致的编程模型,即使使用的是不同的事务管理技术。 public inter...
阅读全文
Log4J的用法
摘要:1、Apache通用日志接口(commons-logging.jar)介绍 Apache Commons包中的一个,包含了日志功能,必须使用的jar包。这个包本身包含了一个Simple Logger,但是功能很弱。在运行的时候它会先在CLASSPATH找log4j,如果有,就使用log4j,如果没有,就找JDK1.4带的 java.util.logging,如果也找不到就用Simple Logge...
阅读全文
PetClinic剖析(三)JAXB(Java Architecture for Xml Binding)
摘要:摘自:http://speed847.iteye.com/blog/454231 JAXB框架使得通过JAVA访问xml变得非常简单 例子: @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class Boy{ String name=”CY”;} public class JAXBTest{ public stati...
阅读全文
Petclinic剖析(二)petclinic-servlet.xml
摘要:1、ViewResolver(视图解析器) <bean class="org.springframework.web.servlet.view.BeanNameViewResolver" p:order="1"/><bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:prefix="/WE...
阅读全文
PetClinic剖析(一)web.xml
摘要:1、webAppRootKey 1.1 在web.xml配置 <context-param><param-name>webAppRootKey</param-name><param-value>web.sample.root</param-value></context-param>可以用System.getProperty("web.sample.root")来获取属性值。在Eclipse调试...
阅读全文