Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Scripting Languages on JVM  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
reply to postflat modethreaded modego to previous topicgo to next topicgo to back
作者 Spring Scala项目:在Scala中使用Spring
阿熊

阿熊

元老


发贴: 5644
于 2012-12-11 22:58 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
SpringSource社区近日推出了Spring Scala项目,该项目的目标是使开发者可以更容易地在Scala中使用Spring框架。

目前Spring Scala项目主要致力于:

1. 使用Spring Beans来配置、注入Scala类,你可以使用传统形式的XML,也可以使用Scala

例如,有一个Scala类:

Scala代码
 
class Person(val firstName: String, val lastName: String)

可以这样来配置,使用c命名空间:
Xml代码
  
<bean id="person" class="Person" c:firstName="John" c:lastName="Doe"/>


2. 提供了对Scala友好的Spring模板,如SimpleJdbcTemplate、JmsTemplate、RestTemplate和TransactionTemplate等。例如,使用JmsTemplate模板:
Scala代码

val connectionFactory : ConnectionFactory = ...
val template = new JmsTemplate(connectionFactory)

template.send("queue") {
session: Session => session.createTextMessage("Hello World")
}

template.receive("queue") match {
case Some(textMessage: TextMessage) => println(textMessage.getText)
case None => println("No text message received")
}

Spring Scala目前还是一个进展中的项目,开发团队称未来几个月内将提供更加完善的功能。

来源:http://blog.springsource.org/2012/12/10/introducing-spring-scala/




话题树型展开
人气 标题 作者 字数 发贴时间
914 Spring Scala项目:在Scala中使用Spring 阿熊 1011 2012-12-11 22:58

reply to postflat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923