ITeye博客

2012 年文章归档

共 11 篇文章

mvc annotation

在Spring3.0中 在Spring3.0.5这个版本上, mvc:annotation-driven/ 声明是没有 defaultAnnotationHandlerMapping这个属性的,对于@ResultMapping标签的解析,是写死了必须用 "org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping” 这个类来处理的。 在Spring 2.5中 那么Spring是如何解析 mvc:annotation-driven/ 标签的呢? 首先,必须要有一个继承自“org.springfra…

2012-05-22 13:33

java读取文件

读取文件方法大全 1、按字节读取文件内容 2、按字符读取文件内容 3、按行读取文件内容 4、随机读取文件内容 复制代码 public class ReadFromFile { /** * 以字节为单位读取文件,常用于读二进制文件,如图片、声音、影像等文件。 */ public static void readFileByBytes(String fileName) { File file = new File(fileName); InputStream in = null; try { System.out.println("以字节为单位读取文件内容,一次读一个字节:"); // 一次读一…

2012-05-03 17:41

bdd

http://www.hascode.com/2011/05/oh-jbehave-baby-behaviour-driven-development-using-jbehave/#Setting_up_a_test_project

2012-04-25 13:18

jersery test

<dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>0.9.28</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-core</artifactId> <version>0.9.28</version> </dependency> <dependency> <groupId>com.googlecode.ehcache-s…

2012-04-17 15:51

Restful TDD maven配置

<dependency> <groupId>com.sun.jersey.contribs</groupId> <artifactId>jersey-spring</artifactId> <version>1.6</version> <exclusions> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring</artifactId> </exclusion> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring-co…

2012-04-16 13:38

spring3.1 加载不进PropertyPlaceholderConfigurer

最近项目升级,spring3.1+mybatis3.1+mybatis-spring1.1.0 数据查询时老是报classNotFound ${jdbc.driverClassName},debuy源码发现PropertyPlaceholderConfigurer在BasicDataSource之后载,正常的情况下应该是这前加载?网上搜了下得到如下结构: 我用spring3.0.6+mybatis3.0.6+mybatis-spring1.0.2做了一个demo,我把数据库连接驱动放在src下,但是我在spring配置文件中加上 <context:property-placeholder l…

2012-04-09 13:31

spring restful

随附文章,“使用 Spring 3 构建 RESTful web 服务”(参见 参考资料),介绍了使用 Spring 构建 RESTful web 服务的方式。还解释了如何使用 ContentNegotiatingViewResolver 生成多个具象,这是 RESTful web 服务的一个重要功能。本文还阐述了使用 HttpMessageConverter 生成多个具象的另一种方式,并且本文中的示例展示了如何使用 RestTemplate 和 HttpMessageConverter 与服务进行通信。 回页首 Spring MVC 中的 REST 支持 本部分提供了支持 RESTful …

2012-03-22 23:25

@ResponseBody & @RequestBody

@ResponseBody & @RequestBody 作用? @RequestBody 将 HTTP 请求正文插入方法中,使用适合的HttpMessageConverter将请求体写入某个对象。 @ResponseBody 将内容或对象作为 HTTP 响应正文返回,使用@ResponseBody将会跳过视图处理部分,而是调用适合HttpMessageConverter,将返回值写入输出流。 HttpMessageConverter接口 <mvc:annotation-driven />开启了之后它给AnnotationMethodHandlerAdapter初始化7个转换器,可以通过调用…

2012-03-22 22:59

spring sample url

http://www.mkyong.com/spring-mvc/spring-3-mvc-and-json-example/ http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/mvc.html#mvc-annotation-driven spring mvct beging http://www.cnblogs.com/zhaoyang/archive/2012/01/07/2315403.html http://static.springsource.org/spring/do…

2012-03-22 22:44

转:Spring3 MVC

大家好,Spring3 MVC是非常优秀的MVC框架,由其是在3.0版本发布后,现在有越来越多的团队选择了Spring3 MVC了。Spring3 MVC结构简单,应了那句话简单就是美,而且他强大不失灵活,性能也很优秀。 官方的下载网址是:http://www.springsource.org/download (本文使用是的Spring 3.0.5版本) Struts2也是比较优秀的MVC构架,优点非常多比如良好的结构。但这里想说的是缺点,Struts2由于采用了值栈、OGNL表达式、struts2标签库等,会导致应用的性能下降。Struts2的多层拦截器、多实例action性能都很好。可…

2012-03-22 22:25

sping DefaultAnnotationHandlerMapping

If you define custom HandlerMapping beans in your DispatcherServlet context, you need to add a DefaultAnnotationHandlerMapping bean explicitly, since custom HandlerMapping beans replace the default mapping strategies. Defining a DefaultAnnotationHandlerMapping also allows for registering custom int…

2012-03-22 22:15