# ne4spring **Repository Path**: 72/ne4spring ## Basic Information - **Project Name**: ne4spring - **Description**: ne4Spring 是基于spring开发的一套框架,它并不会替代谁,只是将开发中常用的一些东西进行一些封装,从而简化开发流程和工序 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: 5.0 - **Homepage**: http://git.oschina.net/72/ne4spring - **GVP Project**: No ## Statistics - **Stars**: 12 - **Forks**: 5 - **Created**: 2015-06-17 - **Last Updated**: 2023-05-22 ## Categories & Tags **Categories**: webframework **Tags**: None ## README ne4Spring 是基于spring开发的一套框架,它并不会替代谁,只是将开发中常用的一些东西进行一些封装,从而简化开发流程和工序 ``` com.tmsps ne4Spring 5.0.0 ``` 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 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 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); } } ```