博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
整合spring roo,maven,mybatis,spring-flex,blazeds,mysql
阅读量:5818 次
发布时间:2019-06-18

本文共 6765 字,大约阅读时间需要 22 分钟。

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

添加<blazeds.version>4.0.0.14931</blazeds.version>为项目添加blazeds开发版本号

2.添加mybatis开发生成器:<!--mybatisgenerator -->

        <repository>

            <id>mybatis-snapshot</id>

            <name>MyBatisSnapshot Repository</name>

            <url>https://oss.sonatype.org/content/repositories/snapshots</url>

        </repository>

3.添加类库依赖<dependency>

            <groupId>org.mybatis</groupId>

            <artifactId>mybatis</artifactId>

            <version>3.0.1</version>

        </dependency>

        <dependency>

            <groupId>org.mybatis</groupId>

            <artifactId>mybatis-spring</artifactId>

            <version>1.1.0</version>

        </dependency>

        <!-- springflex-->

        <dependency>

            <groupId>org.springframework.flex</groupId>

            <artifactId>spring-flex-core</artifactId>

            <version>1.5.2.RELEASE</version>

        </dependency>

        <!-- Blazeds-->

        <dependency>

            <groupId>com.adobe.blazeds</groupId>

            <artifactId>blazeds-core</artifactId>

            <version>${blazeds.version}</version>

        </dependency>

        <dependency>

            <groupId>com.adobe.blazeds</groupId>

            <artifactId>blazeds-common</artifactId>

            <version>${blazeds.version}</version>

        </dependency>

        <dependency>

            <groupId>com.adobe.blazeds</groupId>

            <artifactId>blazeds-proxy</artifactId>

            <version>${blazeds.version}</version>

        </dependency>

        <dependency>

            <groupId>com.adobe.blazeds</groupId>

            <artifactId>blazeds-remoting</artifactId>

            <version>${blazeds.version}</version>

        </dependency>

4.mybatis插件<plugin>

                <groupId>org.mybatis.generator</groupId>

                <artifactId>mybatis-generator-maven-plugin</artifactId>

                <version>1.3.1</version>

                <configuration>

                    <verbose>true</verbose>

                    <overwrite>true</overwrite>

                </configuration>

            </plugin>

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"?>

<beans xmlns="http://www.springframework.org/schema/beans"

    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">

    <context:property-placeholderlocation="classpath*:META-INF/spring/*.properties"/>

 

    <!-- enable autowire-->

    <context:annotation-config/>

 

    <context:component-scanbase-package="com.bingya">

    </context:component-scan>

 

    <tx:annotation-driven/>

 

    <beanclass="org.springframework.jdbc.datasource.DriverManagerDataSource"

        id="dataSource">

        <propertyname="driverClassName"value="${database.driverClassName}"/>

        <propertyname="url"value="${database.url}"/>

        <propertyname="username"value="${database.username}"/>

        <propertyname="password"value="${database.password}"/>

    </bean>

 

    <beanid="transactionManager"

        class="org.springframework.jdbc.datasource.DataSourceTransactionManager">

        <propertyname="dataSource"ref="dataSource"/>

    </bean>

 

    <!-- define the SqlSessionFactory-->

    <beanid="sqlSessionFactory"class="org.mybatis.spring.SqlSessionFactoryBean">

        <propertyname="dataSource"ref="dataSource"/>

        <propertyname="typeAliasesPackage"value="com.bingya"/>

    </bean>

 

    <!-- scan formappers andlet them beautowired -->

    <beanclass="org.mybatis.spring.mapper.MapperScannerConfigurer">

        <propertyname="basePackage"value="com.bingya"/>

    </bean>

</beans>

web.xml

[html] 
 
  1. <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>  
  2. <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  3.     version="2.5"  
  4.     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">  
  5.   
  6.     <display-name>SpringRoo</display-name>  
  7.     <description>Roo generated SpringRoo application</description>  
  8.   
  9.     <context-param>  
  10.         <param-name>contextConfigLocation</param-name>  
  11.         <param-value>classpath*:META-INF/spring/applicationContext*.xml</param-value>  
  12.     </context-param>  
  13.   
  14.     <!-- Creates the Spring Container shared by all Servlets and Filters -->  
  15.     <listener>  
  16.         <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>  
  17.     </listener>  
  18.   
  19.     <!-- Handles Spring requests -->  
  20.     <servlet>  
  21.         <servlet-name>SpringRoo</servlet-name>  
  22.         <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>  
  23.         <init-param>  
  24.             <param-name>contextConfigLocation</param-name>  
  25.             <param-value>WEB-INF/spring/webmvc-config.xml</param-value>  
  26.         </init-param>  
  27.         <load-on-startup>1</load-on-startup>  
  28.     </servlet>  
  29.   
  30.     <servlet-mapping>  
  31.         <servlet-name>SpringRoo</servlet-name>  
  32.         <url-pattern>/messagebroker/*</url-pattern>  
  33.     </servlet-mapping>  
  34. </web-app>  

转载地址:http://ywwdx.baihongyu.com/

你可能感兴趣的文章
路由器发布服务器
查看>>
实现跨交换机VLAN间的通信
查看>>
jquery中的data-icon和data-role
查看>>
python例子
查看>>
环境变量(总结)
查看>>
ios之UILabel
查看>>
Java基础之String,StringBuilder,StringBuffer
查看>>
1月9日学习内容整理:爬虫基本原理
查看>>
安卓中数据库的搭建与使用
查看>>
AT3908 Two Integers
查看>>
渐变色文字
查看>>
C++ 0X 新特性实例(比较常用的) (转)
查看>>
node生成自定义命令(yargs/commander)
查看>>
各种非算法模板
查看>>
node-express项目的搭建并通过mongoose操作MongoDB实现增删改查分页排序(四)
查看>>
PIE.NET-SDK插件式二次开发文档
查看>>
如何创建Servlet
查看>>
.NET 设计规范--.NET约定、惯用法与模式-2.框架设计基础
查看>>
win7 64位+Oracle 11g 64位下使用 PL/SQL Developer 的解决办法
查看>>
BZOJ1997:[HNOI2010]PLANAR——题解
查看>>