# JavaFramework **Repository Path**: snow_hall_moving_guests/JavaFramework ## Basic Information - **Project Name**: JavaFramework - **Description**: 基于SpringBoot 和Spring的简易开发框架,具备与mybatis和jpa兼容的JPA方案,抽象的MVC三层辅组基类,减少开发代码量,统一的大数据访问格式和不同数据来源的集成能力,简易方便使用的xls工具,通用的ES查询工具。springboot 集成及链路追踪功能,能支持所有jdbc数据源的链路追踪 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 2 - **Created**: 2024-10-24 - **Last Updated**: 2024-10-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Simple Java Frame V1.0 Slightly Framework design to support Spring based java or Bigdata program. [![Build Status](https://api.travis-ci.com/robinhood-jim/JavaFramework.svg?branch=master)](https://app.travis-ci.com/github/robinhood-jim/JavaFramework) [![CircleCI](https://circleci.com/gh/robinhood-jim/JavaFramework.svg?style=svg)](https://circleci.com/gh/robinhood-jim/JavaFramework) ![license](https://img.shields.io/badge/license-Apache--2.0-green.svg) 1.Introduction I.This project is base on Spring Framework and has four modules: |----------------------------------------------------------------------------------------------------| | Module | Description | |----------------------------------------------------------------------------------------------------| | Core | the core class include data access layer basic class(model,dao,service) and etc. | |----------------------------------------------------------------------------------------------------| | Comm | FileSystem Access tool(local/vfs),support FileFormat(csv/xml/json/avro/parquet/protobuf)| | | ,support Compress Format(gzip/bzip2/snappy/lzo/zip/lzma/lz4) | | | ,read and write excel,read word or PowerPoint | |----------------------------------------------------------------------------------------------------| |Hadooptool|FileSystem Access tool(hdfs), comm tool to access to HDFS,Hbase,Hive,Mongdb and etc | |----------------------------------------------------------------------------------------------------| |Example |springmvc config based and spring boot based Example; | |----------------------------------------------------------------------------------------------------| |Web |struts1,struts2 and springmvc support web component and required class. | |----------------------------------------------------------------------------------------------------| |Webui |Spring Boot with Oauth2 Thymeleaf Example; | |----------------------------------------------------------------------------------------------------| |Estool | ElasticSearch Comm Query tool | |----------------------------------------------------------------------------------------------------| |Tracer | Zipkin Brave tracing,Can trace All Database and Record parameters | |----------------------------------------------------------------------------------------------------| II. Special feature a.A user defined xml Query config system,similar to mybatis,but easy config. b.Support defined annotation or jpa annotation in JdbcDao with ORM. c. BaseAnnotationService can access DB with minimize code,and use transaction with annotation. d.A common db access meta and util,can access all kind of db. e.Spring cloud based WebUI f.support Hadoop plateform It is available under the terms of either the Apache Software License 2.0 or the Eclipse Public License 1.0. 2.Development I.Model Layer:Simple ORM tool, Support JAVA JPA or my BaseObject Annotation Demostration:(support Composite primary key) 1.Model Class exmaple: core/src/test/java/com/robin/core/test/model TestJPaModel Model annotation with java JPA TestModel model annotation with My model definition TestLob support for clob and blob usage: 1.create class extends BaseObject; 2.create parameter mapping DB cloumns using annotation @MappingEnity ------------------------------------------------------------------- |parameter |reference | |table |tableName | |schema |specify schema | |jdbcDao |Specify JdbcDao(can switch datasource) | | -------------------------------------------------------------------- @MappingField ---------------------------------------------------------------------------------------- |parameter |reference | |field |DB column name,if java param same as columnName,can unsign | |primary |if column is primary,set "1" | |increment |if column is autoincrement,set "1"(MySql/SqlServcer/Postgre/DB2) | |sequenceName |column insert with sequence,set sequenceName | |required |column is not null | |datatype |if column is clob or blob,set "clob" or "blob" | |precise |precise | |scale |scale | |length |length | ---------------------------------------------------------------------------------------- when save or update,Entity will verify use Annotation Composite Primary Key,see example core/src/test/java/com/robin/core/test/model/TestMutiPK 2.Dao Layer: use com.robin.core.base.dao.JdbcDao,no need to Generate new Class 3.Service Layer exmaple: core/src/test/java/com/robin/core/test/service base class: main function --------------------------------------------------------------------------------- |function name |description | |saveEntity |insert to DB | |updateEntity |update to DB | |deleteEntity |delete by key array | |getEntity |select by id | |queryByField |query with specify column and value | |queryBySelectId |query with config query | --------------------------------------------------------------------------------- 4.Query Configuration XML 4.1 Config Spring Bean using Config file xmlConfigPath support three input I.if not assign value,read config xml from classpath:queryConfig II. classpath:query III.jarpath:query read config from jar base Path with relative path using config class @Bean(name="queryFactory") public QueryFactory getQueryFactory(){ QueryFactory factory=new QueryFactory(); factory.setXmlConfigPath(queryConfigPath); return factory; } 4.1 config XML File in xmlConfigPath Path ,add xml file content from t_sys_code a,t_sys_codeset b where a.CS_ID=b.ID and ${queryString} a.ITEM_NAME as ITEMNAME,a.ITEM_VALUE as ITEMVALUE SQLSCRIPT ID refrer to queryBySelectId selectId.example see core test. 5.mybatis like QueryMapper id,name,code_desc,cs_id,create_time name,code_desc,cs_id,create_time insert into t_test ( ) values ( ) insert into t_test values (:name,:description,:csId,sysdate()) update t_test set where id=:id no need to generate Mapper class,Only need QueryMapper xml file exmaple: core/src/test/java/com/robin/core/test/db/JdbcDaoTest testQueryAndInsertMapper insert update delete segement support script rather than ognl 4.Controller layer BaseCrudController basic Single Model base controller, exmaple see example/config-exmaple BaseCrudDhtmlxController dhtmlxGrid base controller,make it easy to develop web and controller. upon feature aim to simplify the work to develop standard MVC java code. II. Bigdata supprot hadooptool: HDFS tool: com.robin.hadoop.hdfs can access HDFS with kerberos security Hbase tool: com.robin.hadoop.hbase hbase tool Cassandra tool : CassandraUtils III. Spring cloud support WebUI simple webui base on dhtmlxGrid 5.1 with spring boot native related project in my another project microservices