The overall design of a real project Java architecture Design __java

Source: Internet
Author: User
Tags object model xslt
1 Overall architecture module diagram 1.1 Abstract schema module diagram

1.2 Specific technical framework module diagram

As shown above, the framework mainly includes:

• MVC Development Framework

L Workflow Technology

L Users, permissions, role management

The details are detailed below. 2 MVC Scenario 2.1 View Layer Technology Scheme (view)

In the application of common development framework, it is used in the view layer: JSP, JSF,FREEMARKER,XSLT, velocity, etc. jsp: a common view layer that does not implement strict MVC separation, and JSP code is almost equivalent to Java code. Performance logic and code are mixed, code reusability, system maintenance is relatively low. The following are described separately:

JSF: component-based event driven, followed by Java EE standards, quick to start, with a large number of reusable components. Reset support is not good, there is no unified implementation, both the implementation of the sun, and the implementation of Apache-myfaces, write a custom component requirements high, more suitable for enterprise applications.

XSLT: One of the template technologies, with excellent scalability and reusability, enables strict MVC separation. XSLT lacks a strong editor support. In performance, compared with the jsp,freemarker,velocity, in the equivalent of the complexity of the presentation layer logic, XSLT performance than several other differences, the memory space occupied more.

Velocity: One of the most common template technologies that can be implemented with strict MVC separation, simple lightweight, and simple syntax. VTL syntax requires a certain amount of learning time and does not support JSP tags.

L Freemarker: One of the most commonly used template technologies to achieve strict MVC separation. Compared with velocity, Freemarker is more powerful, more rigorous in the division of Performance Logic and business logic, and customizable Macro,freemarker supports JSP tags. Freemarker for the syntax is relatively strict, the variable must be assigned a value, the map key must be string.

Based on the above analysis, combined with the development efficiency and operational efficiency, it is suggested to adopt Freemarker as the view layer technology. 2.2 Control Layer Scheme (Controller)

In the commonly used control layer technology, there are STRUCT1,STRUCT2,SPRINGMVC and so on.

1) Struct1: An earlier control-layer framework, not thread-safe, is now rarely used.

2) Struct2: A more mature and widely used framework, that is, classic ssh, more popular

3 Springmvc: Up-and-Comer, currently the most promising technology, listed below with STRUCT2 main contrast:

L SPRINGMVC is superior to struct2 in performance.

L SPRINGMVC is a product of the spring team, who has studied spring and is quick to get started.

L SPRINGMVC can be implemented with 0 configuration, struct2 need not be able to do 0 configuration.

L In terms of development efficiency, SPRINGMVC is relatively struct2 and highly efficient.

L PRINGMVC built-in restful without the support of Third-party Plug-ins.

L Benchmarking, in Taobao, Pat, such as large electrical business website, also using SPRINGMVC as a control layer technology, there are a lot of information can be used as a reference.

From the advanced nature of technology, the complexity of the proposed use of SPRINGMVC as a control layer.

2.3 Model Layer (module)

Two major open source ORM components can be selected: Hibernate and MyBatis.

L Hibernate learning threshold is relatively high, restricted object model, in many tables, complex query, optimization is difficult. For later maintenance or reconstruction, it is more difficult.

L MyBatis belong to half ORM framework, can do fine control to SQL, but development efficiency speaking, slower than hibernate, but conducive to later maintenance in refactoring.

In terms of flexibility, controllability, learning costs and familiarity, the use of Codesmith code generator can greatly improve development efficiency, and it is recommended to use MyBatis as an ORM framework for the project.

2.4 Databases (database)

The databases that may be used are Oracle, MySQL, and the benefits of using MySQL are:

L Source free database, using newer stable version 5.5

L strong function, stable;

L experienced a wide range of mature application Practice test;

L The use of rich experience, easy to use, simple;

L Depending on the user's situation, in the early stage of small-scale use Master-slave master-slave mode backup. The later stage considers: realizes the database reads and writes separates. You can also consider a table, a library, and a cluster to promote read performance.

The benefits of using Oracle are:

L At present the company has used

L Good performance, high safety, complete various schemes

L Customers more recognition

Oracle is still recommended for use at the current company, but MySQL can be used if costs are to be reduced. 2.5 Recommended MVC technical Solution Process 2.5.1 General Flow chart

2.5.2 Control Layer (Controller) flowchart

3 User, role, Rights Management module

CAS +ldap 4 workflow Scenario

The main technologies that can be selected are: Jbpm4,jbpm5,activiti5

Serial number

Technical composition

Activiti

JBPM5

1

Database Persistence Layer ORM

MyBatis3

Hibernate3

2

Persistence Standard

No

JPA specification

3

Transaction management

MyBatis mechanism/spring Transaction control

Bitronix, based on JTA transaction management

4

How database is connected

Jdbc/datasource

Jdbc/datasource

5

Support Database

Most databases such as Oracle, SQL Server, MySQL

Most databases such as Oracle, SQL Server, MySQL

6

Design Patterns

Command mode, observer mode, etc.

7

Internal Service Communications

Call between service via API

Based on Apache Mina asynchronous communication

8

Integrated interface

SOAP, Mule, RESTful

Message communication

9

Supported process formats

BPMN2, XPDL, JPDL, etc.

Currently only supports BPMN2 XML

10

Engine Core

PVM (Process virtual machine)

Drools

11

Technology predecessor

JBPM3, JBPM4

Drools Flow

12

Affiliated Company

Alfresco

jboss.org

As there is no in-depth analysis, the preliminary idea may be biased towards Activiti5 because it is better integrated with the current architecture

5 Data Integration ETL Tools

Kettle is a foreign open source of ETL tools, pure Java writing, can be in Windows, Linux, UNIX run, data extraction efficient and stable. Kettle Chinese name is kettle, the project's main programmer Matt wants to put a variety of data into a pot and then flow out in a specified format. Kettle adopted the LGPL protocol, that is, the modified procedures can be released, can be assured of use, without regard to copyright issues.

6 General Base Module/component Solution 6.1 Log Components

L use Java Platform most commonly used log4j log component 6.2 Cache component

L The use of a single application server in the early days can be directly used MyBatis built-in caching mechanism or server cache development;

L late in the light of actual operations, to use the cluster deployment approach, the use of memcached to form a distributed cluster cache, so there is no cache synchronization problem.

• Embed caching functionality into your code through spring's AOP combination memchched, and develop caching strategies based on actual business scenarios.


Updated---------------------------------------2017-11-26----------------------------------------------------


7 Source Download This period of time is very grateful to everyone's concern, there are many peers to see the blog to download the source code, I also unified reply several times mail, simply published here to download the address, we can directly use Baidu Network disk download, and the structure of the rapid change, Suggest you can learn the current more mature and comprehensive framework, such as Jeesite, JEECG and so on, this blog sample code address: Http://pan.baidu.com/s/1minAVmo, extract code: M8GS Download Compressed package, after decompression folder description as follows:

Note: All information is only used for learning reference.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.