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调试...
阅读全文
WEB.xml详解
摘要:引用自:http://www.cnblogs.com/chinafine/archive/2010/09/02/1815980.html 1 定义头和根元素 部署描述符文件就像所有XML文件一样,必须以一个XML头开始。这个头声明可以使用的XML版本并给出文件的字符编码。DOCYTPE声明必须立即出现在此头之后。这个声明告诉服务器适用的servlet规范的版本(如2.2或2.3)并指定管理此...
阅读全文
Junit学习(二):代码测试的策略
摘要:一、如何编写可测试的代码: 1、公共的API就是契约(public api are contracts):为了保证程序向后兼容能力,永远不要修改public方法的签名。 2、减少依赖(reduce dependcy):将初始化新对象的方法和提供业务逻辑的方法隔离开。例子: class Vehicle { Driver d = new Driver(); boolean hasDriver = t...
阅读全文
Junit4学习(一):Juint入门 keeps the bar green to keep the code clean
摘要:1、静态引入 jdk1.5可以引入一个静态类的所有方法。引入以后在类中直接使用静态方法,无须加类名. 语法: import static org.junit.Assert.*; 2、assertThat:hamcrest断言 assertThat 可以替代其他所有的assert方法,在后续的测试中,建议使用assertThat方法。 assertThat匹配符:一般匹配符,字符匹配符,数...
阅读全文