1.下载spring roo,设置环境变量ROO_HOME,和path,classpath.
使用CMD命令行找到工作区间,新建工程目录转到工程目录;mkdir ten-minutes
$ cdten-minutes
2. project--topLevelPackage com.tenminutes
3. roo>jpa setup --provider HIBERNATE--database HYPERSONIC_IN_MEMORY
4. roo>hint
5. roo>entity jpa --class ~.Timer--testAutomatically
6. roo>hint
7. roo>field string --fieldName message--notNull
8. roo>hint web mvc
9. roo>web mvc setup
10. roo>web mvc all --package ~.web
11. roo>selenium test --controller~.web.TimerController
12. roo>perform tests
13. roo>perform package
14. roo>perform eclipse
15. roo>quit
16. $mvn tomcat:run
添加4.0.0.14931为项目添加blazeds开发版本号
2.添加mybatis开发生成器:
mybatis-snapshot
MyBatisSnapshot Repository
https://oss.sonatype.org/content/repositories/snapshots
3.添加类库依赖
org.mybatis
mybatis
3.0.1
org.mybatis
mybatis-spring
1.1.0
org.springframework.flex
spring-flex-core
1.5.2.RELEASE
com.adobe.blazeds
blazeds-core
${blazeds.version}
com.adobe.blazeds
blazeds-common
${blazeds.version}
com.adobe.blazeds
blazeds-proxy
${blazeds.version}
com.adobe.blazeds
blazeds-remoting
${blazeds.version}
4.mybatis插件
org.mybatis.generator
mybatis-generator-maven-plugin
1.3.1
true
true
5.可能需要转到Blazeds目录将一些类库打进去maven类库,命令行如下:mvn install:install-file -Dpackaging=jar -DgroupId=com.adobe.blazeds -Dversion=4.0.0.14931 -DartifactId=blazeds-common -Dfile=flex-messaging-common.jar
mvn install:install-file -Dpackaging=jar -DgroupId=com.adobe.blazeds-Dversion=4.0.0.14931 -DartifactId=blazeds-core -Dfile=flex-messaging-core.jar
mvn install:install-file -Dpackaging=jar -DgroupId=com.adobe.blazeds-Dversion=4.0.0.14931 -DartifactId=blazeds-opt -Dfile=flex-messaging-opt.jar
mvn install:install-file -Dpackaging=jar -DgroupId=com.adobe.blazeds-Dversion=4.0.0.14931 -DartifactId=blazeds-proxy -Dfile=flex-messaging-proxy.jar
mvn install:install-file -Dpackaging=jar -DgroupId=com.adobe.blazeds-Dversion=4.0.0.14931 -DartifactId=blazeds-remoting -Dfile=flex-messaging-remoting.jar
mvn install:install-file -Dpackaging=jar -DgroupId=com.adobe.blazeds-Dversion=4.0.0.14931 -DartifactId=blazeds-rds-server -Dfile=flex-rds-server.jar
修改一下propertis,数据库配置文件,格式如下:#Updated at Mon Apr 09 09:15:39 CST 2012
#Mon Apr09 09:15:39 CST 2012
database.driverClassName=com.mysql.jdbc.Driver
database.url=jdbc\:mysql\://localhost\:3306/managerplatform
database.username=root
database.password=qwer123456
使用 database introspect --schemafeedback_schema 来内部检查数据库模式。
完成数据库模式内部检查以后,您可以用 database reverse engineer --schemafeedback_schema --package ~.domain 对模式进行反向工程。
准备好mybatis的生成器配置文件,利用命令行运行mvn mybatis-generator:generate。
6.上下文配置:<?xmlversion ="1.0"encoding="UTF-8"standalone="no"?>
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/jeehttp://www.springframework.org/schema/jee/spring-jee-3.1.xsd http://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx-3.1.xsd">
id="dataSource">
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
web.xml
version="2.5"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
SpringRoo
Roo generated SpringRoo application
contextConfigLocation
classpath*:META-INF/spring/applicationContext*.xml
org.springframework.web.context.ContextLoaderListener
SpringRoo
org.springframework.web.servlet.DispatcherServlet
contextConfigLocation
WEB-INF/spring/webmvc-config.xml
1
SpringRoo
/messagebroker/*