Your SlideShare is downloading. ×
通行证项目技术分享
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

通行证项目技术分享

2,378
views

Published on

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
2,378
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
28
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. 通行证项目应用技术 吴永照 2010.05
  • 2. Agenda
    • 通行证项目结构
    • Spring 多视图处理
    • Spring 3 新功能
    • Freemarker
    • XMemcached
    • 开发技巧
  • 3. 通行证项目结构
  • 4. Spring 多视图处理
    • Api 多视图
      • http://userapi.kaiqi.com/register/{cid}
      • http://userapi.kaiqi.com/register/{cid}.{format}
      • http://userapi.kaiqi.com/register/{cid}?format={format}
      • Format=json, xml
    • ContentNegotiatingViewResolver
    • DynamicJacksonJsonView : json 视图
    • MarshallingView : XML 视图
    • SingleViewViewResolver : String 视图
  • 5. Spring 3 新功能
    • IoC
    • Rest support
    • @MVC
    • Bean validation
  • 6. Spring 3 : IoC
    • Spring 2.5
    • ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
    • UserDAO userDAO = (UserDAO) context.getBean("userDAO");
    • Spring 3
    • ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
    • UserDAO userDAO = context.getBean("userDAO", UserDAO.class);
    • JSR 330
    • @Qualifier
    • @Named
    • @Qualifier 和 @Named 意义几乎相同,差异在于后者是 String base 的 @Qualifier 。而 Spring3 选择了 @Qualifier , Guice 选择了 @Named 作为 " 修饰 " 。包括自定 annotation 策略也相同
    • @Inject
    • Spring3 的 @Autowired 与 JSR-330 的 @Inject 完全相同, Spring3 习惯是用 @Autowired ,而 Guice 则是有自己的 @Inject
  • 7. Spring 3 : Rest Support
    • MVC 对 Rest 支持
      • @RequestMapping
      • @RequestParam
      • @PathVariable
      • @ModelAttributes
      • @SessionAttributes
      • @CookieValue
      • @RequestHeader
    • Rest Client : RestTemplate
    • 整合 Apache HttpClient
  • 8. Spring 3 : @MVC
    • Spring 2.5
    • <bean class=&quot;org.springframework.web.portlet.mvc.annotation.DefaultAnnotationHandlerMapping&quot;/>
    • <bean class=&quot;org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter&quot;/>
    • Spring 3
    • <mvc:annotation-driven/>
  • 9. Spring 3 : Bean Validation
    • 数据绑定
    • @ModelAttribute(&quot;registerVo&quot;) RegisterVo registerVo
    • <@spring.bind &quot;registerVo.username&quot; />
    • <@spring.bind &quot;registerVo.password&quot; />
    • JSR 303
    • @NotNull
    • @AssertTrue, @AssertFalse
    • @Min, @Max
    • @DecimalMin, @DecimalMax
    • @Size
    • @Digits
    • @Past, @Future
    • @Pattern
    • Hibernate Validator
  • 10. Freemarker
    • 多页面类型处理
    • FreeMarkerMultipleViewResolver
    • 结合 Spring 进行数据绑定
    • <#import &quot;/spring.ftl&quot; as spring />
    • <@spring.bind &quot;registerVo.username&quot; />
  • 11. XMemcached
    • Spring 3 配置 XMemcached
    • memCachedClient.set(String key, int time, Object value);
  • 12. 开发技巧
    • SpringContextHolder
    • 配置文件命名及内容分离
    • Spring bean init() 代替 StartLinsener
  • 13. Thanks!
    • Q & A