• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

ne4spring: ne4Spring 是基于spring开发的一套框架,它并不会替代谁,只是将开发中常 ...

原作者: [db:作者] 来自: 网络 收藏 邀请

ne4Spring 是基于spring开发的一套框架,它并不会替代谁,只是将开发中常用的一些东西进行一些封装,从而简化开发流程和工序

<dependency>    <groupId>com.tmsps</groupId>    <artifactId>ne4Spring</artifactId>    <version>5.0.0</version></dependency>

Ne4Spring升级至Spring5.0,同时同步了Spring的版本号,创建了新的分支

如何使用GeUtil生成Bean

package gold;

import java.io.IOException;import java.sql.SQLException;import java.util.List;

import org.springframework.beans.factory.BeanFactory;import org.springframework.context.support.FileSystemXmlApplicationContext;

import com.alibaba.druid.pool.DruidDataSource;import com.alibaba.fastjson.JSON;import com.tmsps.ne4spring.utils.generator.BeanGenerator;import com.tmsps.ne4spring.utils.generator.GeUtils;import com.tmsps.ne4spring.utils.generator.TableMeta;

public class SpringUtils {private static BeanFactory bf;

public static <T extends Object> T getBean(String beanId) {    bf = new FileSystemXmlApplicationContext("classpath:applicationContext.xml");    @SuppressWarnings("unchecked")    T bean = (T) bf.getBean(beanId);    return bean;}public static void main(String[] args) throws SQLException {    long start = System.currentTimeMillis();    System.err.println("开始生成");    DruidDataSource ds = SpringUtils.getBean("dataSource");    GeUtils ge = new GeUtils(ds.getConnection());    //bean文件输出的文件夹路径    String outPath = ge.getPath()+ "/src/main/java/com/tmsps/gold/bean";    System.err.println(outPath);    List<TableMeta> tableMetas =  ge.getTableMetas();    System.err.println(JSON.toJSON(tableMetas));    for (TableMeta tableMeta2 : tableMetas) {        //bean的package 路径        new BeanGenerator("com.tmsps.gold.bean").getBeanContent(tableMeta2);    }    for (TableMeta tableMeta2 : tableMetas) {        try {            ge.wirtToFile(tableMeta2, outPath);        } catch (IOException e) {            e.printStackTrace();        }    }    long end = System.currentTimeMillis();    System.err.println("运行结束,耗时 :"+(end-start)/1000);}

}


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
SYFramework: 泷涯自用的框架发布时间:2022-02-13
下一篇:
tkoa: 使用 TypeScript 编写的 Node.js Koa 框架发布时间:2022-02-13
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap