首页  

play scala slick example     所属分类 play 浏览量 757
https://github.com/playframework/play-samples/tree/2.8.x/play-scala-slick-example

This project demonstrates how to create a simple CRUD application with Play and Slick using Play-Slick.


SLICK
Reactive Functional Relational Mapping for Scala

The Play Slick module makes Slick a first-class citizen of Play, and consists of two primary features:
Integration of Slick into Play’s application lifecycle.
Support for Play database evolutions.


sbt run
http://127.0.0.1:9000
使用h2 数据库 ,需要初始化  

An SQL script will be run on your database -  Apply this script now!
This SQL script must be run:

create table "people" (
3"id" bigint generated by default as identity(start with 1) not null primary key,
4"name" varchar not null,
5"age" int not null
6);

点击按钮 Apply this script now!  

配置 http 端口
sbt run -Dhttp.port=9100

路由配置
play-scala-slick-example/conf/routes

GET  /   controllers.PersonController.index
POST /   personcontrollers.PersonController.addPerson
GET  /   personscontrollers.PersonController.getPersons


项目导入 idea
run / edit configurations
添加一个 sbt task 
name  输入 play-scala-slick-example
tasks 输入 run 
注意 不要勾选  use sbt shell
vm parameters  可配置 jvm 参数 
-Xms512M -Xmx1024M -Xss1M -XX:+CMSClassUnloadingEnabled -Dhttp.port=9200


play-scala-slick-example/build.sbt lazy val root = (project in file(".")) .enablePlugins(PlayScala) .settings( name := """play-scala-slick-example""", version := "2.8.x", scalaVersion := "2.13.6", libraryDependencies ++= Seq( guice, "com.typesafe.play" %% "play-slick" % "5.0.0", "com.typesafe.play" %% "play-slick-evolutions" % "5.0.0", "com.h2database" % "h2" % "1.4.199", specs2 % Test, ), scalacOptions ++= Seq( "-feature", "-deprecation", "-Xfatal-warnings" ) ) play-scala-slick-example/project/build.properties # 1.3.13 sbt.version=1.6.1 配置 sbt 版本 sbt -version sbt version in this project: 1.6.1 sbt script version: 1.6.1 显示依赖 sbt dependencyTree 注意低版本 不支持 dependencyTree

上一篇     下一篇
play REST hello 实例

一些面试知识点整理

Scala快速入门

scala简易指南

ETL工具简介

数据仓库和管道构建指南