1 Star 0 Fork 0

magicfish1981/framework-java

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

JAVA WEB 开发框架

使用方法

安装开发工具

  • 安装jdk, eclipse, tomcat, mysql/oracle

  • 安装eclipse插件 Egit, Maven Integration for WTP

从git服务器clone开发框架

git clone https://github.com/intostorm/framework.git

运行 framework/appendix/install-maven-jars.bat,安装第三方maven依赖

创建开发使用的数据库, 此处以mysql 为例

mysql> create database sample
mysql> create table `contact` ( \
  `record_id` int(11) not null auto_increment comment '主键', \
  `name` varchar(255) default null comment '姓名', \
  `sex` varchar(255) default null comment '性别', \
  `phone` varchar(255) default null comment '电话', \
  `areacode` varchar(255) default null comment '地区', \
  `address` varchar(255) default null comment '地址', \
  primary key (`record_id`) \
) engine=innodb default charset=utf8;

用生成工具tools生成工程代码

打开tools/src/main/resources/datasource-context.xml,添加

<bean id="dataSourceSample" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
	<property name="driverClassName" value="com.mysql.jdbc.Driver" />
	<property name="url" value="jdbc:mysql://localhost:3306/sample?characterEncoding=utf-8" />
	<property name="username" value="root" />
	<property name="password" value="" />
</bean>

打开tools/src/main/resources/appgen-context.xml,添加

<bean id="sample" class="com.ccesun.framework.tools.appgen.AppGenConfiguation">
	<property name="baseOutput" value="appgen" />
	<property name="projectName" value="sample" />
	<property name="basePackage" value="com.ccesun.sample" />
	<property name="dataSource" ref="dataSourceSample" />
	<property name="freemarkerConfig" ref="freemarkerConfig" />
	<property name="hibernateDialect" value="org.hibernate.dialect.MySQL5Dialect" />
	<property name="projectVersion" value="1.0" />
	<property name="frameworkVersion" value="2.0.1" />
</bean>

运行com.ccesun.framework.tools.runner.CodeGenRunner

在tools/appgen下找到生成的工程代码

用生成工具tools生成代码片段(可选)

打开tools/src/main/resources/codegen-context.xml,添加

<bean id="sample" class="com.ccesun.framework.tools.codegen.SimpleCodeGenConfiguation">
	<property name="freemarkerConfig" ref="freemarkerConfig" />
	<!-- 引用 tools/src/main/resources/datasource-context.xml 中设置的dataSource -->
	<property name="dataSource" ref="dataSourceSample" /> 
	<!-- 
		设成true生成全部对象, materials 中的条目会被忽略 
		设成false生成 materials 中的条目 
	-->
	<property name="allArticfacts" value="false" />
	<!-- 输出的目录 -->
	<property name="baseOutput" value="codegen/sample" />
	<!-- 基础包名 -->
	<property name="basePackage" value="com.ccesun.sample" />
	<!-- 指定本次生成的对象,当 allArticfacts 为false 时-->
    <property name="materials">
        <list> 
            <bean p:domainName="Contact" p:tableName="contact" class="com.ccesun.framework.tools.codegen.Material" />
        </list>
    </property>
</bean>

修改中

<bean id="codeGen" class="com.ccesun.framework.tools.codegen.CodeGen">
	<property name="config" ref="sample" />
</bean>

在tools/codegen下找到生成的代码片段

作者

zhuyuanbin2010

Jaron

版权所有

Copyright 2013 CCEsun, Inc.

空文件

简介

取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/magicfish/framework-java.git
git@gitee.com:magicfish/framework-java.git
magicfish
framework-java
framework-java
master

搜索帮助