playframework Java_playframework - 使用

play framework 2.x 是使用scala与java开发的一款框架、不能说是一个框架应该说是一种解决方案。

9d51eb27a888

play framework 优点有如下几个:

开发效率高、scala的特点函数式编程。

无状态、可扩展性极好。

热部署、修改源码直接动态编译、无需重启服务。

优秀的RESTFul框架。

Play的生态圈在不断扩开。

使用介绍

jdk1.8环境安装 (忽略)

SBT安装

模板框架使用

SBT安装

使用版本为当前文章时间点的最新版本1.2.8

Homebrew mac系统

brew install sbt@1

配置sbt的环境、与Java环境配置一样

成功安装如下

sbt -v

[process_args] java_version = '8'

# Executing command line:

java

-Xms1024m

-Xmx1024m

-XX:ReservedCodeCacheSize=128m

-XX:MaxMetaspaceSize=256m

-jar

/usr/local/Cellar/sbt/1.2.8/libexec/bin/sbt-launch.jar

[info] Loading global plugins from /Users/lake/.sbt/1.0/plugins

[info] Loading settings for project cc-build from plugins.sbt ...

[info] Loading project definition from /Users/lake/dounine/github/zhuxueyuan-play/cc/cc/project

[info] Loading settings for project root from build.sbt ...

[info] Set current project to cc (in build file:/Users/lake/dounine/github/zhuxueyuan-play/cc/cc/)

[info] sbt server started at local:///Users/lake/.sbt/1.0/server/dd2dc1e31d073ed11adb/sock

[cc] $

创建Java模板项目

sbt new playframework/play-java-seed.g8

[info] Loading global plugins from /Users/lake/.sbt/1.0/plugins

[info] Set current project to cc (in build file:/Users/lake/dounine/github/cc/)

[info] Set current project to cc (in build file:/Users/lake/dounine/github/cc/)

This template generates a Play Java project

name [play-java-seed]: test

organization [com.example]: com.dounine

Template applied in /Users/lake/dounine/github/cc/./test

运行项目(首次运行项目会下载包、这时间可以去喝一杯咖啡)

cd test

sbt run

成功结尾显示如下

[info] Done updating.

[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.

--- (Running the application, auto-reloading is enabled) ---

[info] p.c.s.AkkaHttpServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9000

(Server started, use Enter to stop and go back to the console...)

9d51eb27a888

创建Scala模板项目(同上)

sbt new playframework/play-scala-seed.g8

cd test

sbt run

其它

访问不存在的接口则显示如下

9d51eb27a888

Intellij-idea debug调试如下

debug方式运行

sbt run -jvm-debug 9999

创建远程连接

9d51eb27a888

直接对代码debug即可

最后

后面会继续出play framework实战系列的文章、我在这等你。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值