zoukankan      html  css  js  c++  java
  • spring roo初体验

    1、下载spring-roo-2.0.0.M1,并执行如下命令,在/usr/local/bin下面建立一个roo的软连接
     
    sudo ln -s /Users/pud/Documents/still/spring/roo/spring-roo-2.0.0.M1/bin/roo.sh /usr/local/bin/roo
     
    2、在sts的dashborad里面安装roo插件,注意sts的版本是3.7.2.RELEASE,之前用的是3.6.3,咋装装不上。
     
    3、在sts中创建一个spring roo工程。
     
    4、创建连接数据库
    persistence setup --provider HIBERNATE --database MYSQL --userName root --password 123456 --databaseName conference
     
    5、创建实体
    entity jpa --class ~.domain.Speaker --testAutomatically
    entity jpa --class ~.domain.Talk --testAutomatically
     
    6、为实体添加字段
    field string --fieldName firstname --class ~.domain.Speaker --notNull
    field string --fieldName lastname --notNull
    field string --fieldName email --unique --notNull
    field string --fieldName organization
    field date --fieldName birthdate --type java.util.Date --past --notNull
    field number --type java.lang.Long --fieldName age --min 25 --max 60
     
    field string --fieldName title --class ~.domain.Talk --notNull
    field string --fieldName description --notNull --sizeMax 4000
     
    7、为实体增加关联关系
    field set --fieldName talks --type com.dw.roo.conference.domain.Talk --class com.dw.roo.conference.domain.Speaker --mappedBy speaker --notNull false --nullRequired false --cardinality ONE_TO_MANY --transient false --permitReservedWords false
     
    field reference --fieldName speaker  --type com.dw.roo.conference.domain.Speaker --class com.dw.roo.conference.domain.Talk --notNull true --nullRequired false --transient false --permitReservedWords false 
     
    8、增加controller
    controller all --package ~.web
     
    9、添加日志
    logging setup --level INFO --package ALL_SPRING
  • 相关阅读:
    互联网协议入门
    C++解决约瑟夫环(史上最清晰)
    C# 最快的逐一打印斐波那契结果数列的算法
    二叉树的遍历(转载)
    C# 多线程join的用法,等待多个子线程结束后再执行主线程
    剖丁解牛式的快速排序分析
    用CTE结合排名函数rank()删除某列值重复的记录
    Http 头部属性详解
    C# 冒泡排序
    设计模式七大原则之依赖倒转原则
  • 原文地址:https://www.cnblogs.com/puroc/p/5035550.html
Copyright © 2011-2022 走看看