Traditional Culture Encyclopedia - Traditional festivals - What are the common java frameworks
What are the common java frameworks
The top ten commonly used frameworks:
One, SpringMVC
Two, Spring
Three, Mybatis
Four, Dubbo
Five, Maven
Six, RabbitMQ
Seven, Log4j
Eight, Ehcache
nine, Redis
ten, Shiro
Extended reading:
one, SpringMVC
Spring Web MVC is a Java-based implementation of the Web MVC design pattern request-driven type of lightweight Web framework, that is, using the MVC architecture pattern ideas, the web layer for decoupled responsibilities , based on the request-driven refers to the use of request-response model , the purpose of the framework is to help us simplify the development of Spring Web MVC is also to simplify our daily Web development .
Model (Model) encapsulates the application data and generally they will be composed of POJO.
View (View) is responsible for presenting the model data and generally it generates HTML output that the client browser can interpret.
The Controller is responsible for handling user requests and building the appropriate model and passing it to the View for rendering.
Spring's web model - view - controller (MVC) framework is designed around a DispatcherServlet that handles all HTTP requests and responses.
Spring Web MVC process for handling requests
The specific implementation steps are as follows:
1. First the user sends a request ----> front-end controller, the front-end controller based on the request information (such as URL) to decide which page controller to choose for processing and delegate the request to it, that is, the control logic part of the previous controller; steps 1 and 2 in Figure 2-1;
2, the page controller receives the request, the functional processing, you first need to collect and bind the request parameters to an object, which is called a command in the Spring Web MVC object, and validation, and then delegate the command object to the business object for processing; after processing returns a ModelAndView (model data and logical view name); Figure 2-1 in the 3, 4, 5 steps;
3, the front-end controller to take back control, and then according to the return of the logical view name, select the appropriate view for rendering, and pass the model data into the so that the view is rendered; steps 6 and 7 in Figure 2-1;
4. The front-end controller again takes back control and returns the response to the user, step 8 in Figure 2-1; so the whole end.
Two, Spring
2.1, IOC container: blogs.com/linjiqin/archive/2013/11/04/3407126.html
IOC container is the container with dependency injection, IOC container is responsible for instantiating, locating, configuring the application's The IOC container is responsible for instantiating, locating, and configuring objects in the application and establishing dependencies between those objects. The application does not need to new the relevant objects directly in the code, the application is assembled by the IOC container. In Spring, the BeanFactory is the actual representative of the IOC container.
2.2, AOP: /moreevan/article/details/11977115
Simply put, it is not related to the business, but for the business module *** with the call logic or responsibility encapsulated, to facilitate the reduction of duplication of code in the system to reduce the degree of inter-module coupling, and is conducive to the future operability and maintainability. Maintainability.AOP represents a horizontal relationship
AOP is used to encapsulate cross-cutting concerns, specifically in the following scenarios:
Authentication permission?
Caching?
Context passing Content passing?
Error handling?
Lazy loading?
Debugging?
Logging, tracing, profiling and monitoring Logging tracing Optimizing Calibrating?
Performance optimization Performance optimization?
Persistence persistence?
Resource pooling?
Synchronization?
Transactions
3. MyBatis
MyBatis is an excellent persistence framework that supports common SQL queries, stored procedures, and advanced mapping. MyBatis eliminates almost all of the JDBC code and manual setting of parameters and retrieval of result sets. MyBatis uses simple XML or annotations for configuration and raw mapping to map interfaces and Java's POJOs (Plain Old Java Objects) to records in the database.
Overall process:
(1) Load configuration and initialize ?
Trigger condition: load configuration file?
Load the SQL configuration information into a MappedStatement object (including the incoming parameter mapping configuration, the executed SQL statement, and the result mapping configuration) and store it in memory.
(2) Receive call request?
Trigger condition: call the API provided by Mybatis?
Incoming parameters: for the ID of the SQL and the incoming parameter object?
Processing: pass the request to the lower request processing layer for processing.
(3) Processing operation request Trigger condition: API interface layer passes the request over?
Incoming parameters: the ID of the SQL and the incoming parameter object
Processing:
(A) Find the corresponding MappedStatement object according to the ID of the SQL.
(B) Parse the MappedStatement object based on the incoming parameter object to get the final SQL to be executed and execute the incoming parameters.
(C) Get the database connection, execute to the database based on the final SQL statement and execution incoming parameters obtained, and get the execution result.
(D) Converts the obtained execution result according to the result mapping configuration in the MappedStatement object and gets the final result.
(E) Release the connection resources.
(4) Return Processing Results returns the final processing results.
One of the most powerful features of MyBatis is its dynamic statement capability. If you have previously used JDBC or similar framework experience, you will understand the conditions of the SQL statement to connect together how painful it is to make sure that you can not forget the space or do not omit a comma after the columns columns and so on. Dynamic statements take all of that pain out of the equation.
Four, Dubbo
Dubbo is a distributed services framework , is committed to providing high-performance and transparent RPC (Remote Procedure Call Protocol) remote service invocation scheme , as well as SOA service governance solutions. Simply put, dubbo is a service framework , if there is no distributed demand , in fact, do not need to use , only in the distributed , there is dubbo such a distributed service framework needs , and is essentially a service call east and west , to put it bluntly is a remote service call distributed framework.
1, transparent remote method calls, like calling local methods to call remote methods, only simple configuration, without any API intrusion.
2, soft load balancing and fault tolerance mechanism , can be used in the intranet instead of F5 and other hardware load balancers , reduce costs and reduce single point .
3, automatic service registration and discovery, no longer need to write dead service provider address, the registration center based on the interface name to query the IP address of the service provider, and can be smooth to add or remove the service provider.
Node role description: ?
Provider: The service provider that exposes the service.?
Consumer: The service consumer that invokes the remote service.?
Registry: The registry where services are registered and discovered.
Monitor: A monitoring center that counts the number of invocations of a service and how long they take.
Container: The service runtime container.
V. Maven
Maven this project management and build automation tools, more and more developers use it to manage the project jar package. But for us programmers, we are most concerned about its project build feature.
Six, RabbitMQ
Message queues are generally in the project, some do not need to return immediately and time-consuming operation is extracted, asynchronous processing, and this asynchronous processing greatly saves the server request response time, thereby improving the system throughput.
RabbitMQ is a highly concurrent and reliable AMQP message queuing server implemented in Erlang.
Erlang is a dynamically typed functional programming language. Corresponding to Erlang, each Actor corresponds to an Erlang process, and processes communicate with each other through message passing. The immediate benefit of inter-process communication via message passing is the elimination of direct locking overhead compared to ****-enjoyed memory (disregarding the application of locks in the underlying implementation of the Erlang virtual machine).
AMQP (Advanced Message Queue Protocol) defines a message system specification. This specification describes how subsystems interact via messages in a distributed system.
VII, Log4j
Logging priority, categorized as OFF, FATAL, ERROR, WARN, INFO, DEBUG, ALL, or a level you define.
VIII, Ehcache
EhCache is a pure Java in-process caching framework , with fast , lean and other characteristics , is the default CacheProvider in Hibernate . Ehcache is a widely used open source Java distributed cache . Mainly for general-purpose cache , Java EE and lightweight containers. It has memory and disk storage , cache loader , cache extensions , cache exception handler , a gzip cache servlet filter , support for REST and SOAP api features.
Benefits:?
1, fast ?
2, simple?
3. multiple caching strategies?
4. Cached data has two levels: memory and disk, so there is no need to worry about capacity?
5. Cached data is written to disk during VM reboot?
6. Distributed caching is possible via RMI, pluggable APIs, etc.?
7. with a listening interface to the cache and cache manager?
8, support for multiple cache manager instances , as well as an instance of multiple cache regions ?
9. Provides a cache implementation of Hibernate
Drawbacks:?
1, the use of disk Cache is very occupied disk space: this is because of the simplicity of the DiskCache algorithm , the algorithm is simple also leads to the efficiency of the Cache is very high. It just appends the elements directly to the storage. Therefore, it is very fast when searching for elements. If you use DiskCache, in very frequent applications, the disk will soon be full.
2, can not guarantee the safety of the data: when a sudden kill off java, there may be conflicts, EhCache's solution is to rebuild the cache if the file conflict. this may be unfavorable for the Cache data need to be saved. Of course, Cache is just a simple acceleration, and can not guarantee the safety of the data. If you want to ensure the security of data storage, you can use Bekeley DB Java Edition version. This is an embedded database. You can ensure storage security and space utilization.
Nine, Redis
redis is a key-value storage system. Similar to Memcached, it supports relatively more value types for storage, including string (string), list (chained list), set (set), zset (sorted set - ordered set) and hash (hash type). All of these data types support push/pop, add/remove and fetch intersection and union and difference and richer operations, and all of these operations are atomic. On top of that, redis supports sorting in a variety of different ways. Like memcached, data is cached in memory for efficiency. The difference is that redis periodically writes updated data to disk or writes modification operations to an appended record file, and on top of that implements master-slave (master-slave) synchronization.
Redis databases are entirely in-memory, using disk only for persistence. Redis has a richer set of data types than many key-value data stores.Redis can replicate data to any number of slave servers.
1.2, Redis Advantages:
(1) Exceptionally Fast: Redis is very fast, capable of executing about 110,000 collections per second and about 81,000+ records per second.
(2) supports a rich set of data types: Redis supports the most most developers already know like lists, sets, ordered sets, hash data types. This makes it very easy to solve a wide variety of problems because we know which problems are better handled by its data types.
(3) Operations are atomic: All Redis operations are atomic, which ensures that if two clients access the Redis server at the same time they will get the updated value.
(4) Multi-purpose utility: Redis is a multi-purpose utility that can be used for multiple purposes such as caching, messaging, queuing (Redis natively supports publish/subscribe), any ephemeral data, applications such as web application sessions, web page hit counts, etc.
1.3, Redis disadvantages:?
(1) Single-threaded?
(2) memory-consuming
X, Shiro
Apache Shiro is a security framework for Java, designed to simplify authentication and authorization.Shiro can be used in both JavaSE and JavaEE projects. It is mainly used to deal with authentication, authorization, enterprise session management and encryption, etc. Shiro's specific function points are as follows:
(1) authentication/login, to verify that the user does not have the appropriate identity;
(2) authorization, i.e., privilege validation, to verify that an authenticated user does not have a certain privilege; i.e., to determine whether the user can do things, common such as: verify that whether a user has a certain role. Or fine-grained verification of whether a user has certain rights to a resource;
(3) session management, i.e., the user logged in is a session, before not logging out, all of its information in the session; session can be a common JavaSE environment, can also be such as the Web environment;
(4) encryption, to protect the security of the data, such as encrypted passwords stored to the database instead of plaintext;
(5) Web support, can be very easily integrated into the Web environment; ?
Caching: Caching, for example, after a user logs in, its user information, has the role/permissions do not have to check each time, which can improve efficiency;
(6) shiro support for multi-threaded applications concurrent authentication, that is, such as in a thread to open another thread, can be propagated through the permissions automatically;
(7) to provide testing support;
(8) to provide testing support;
(9) shiro support for the use of the Web, can be very easy to integrate into the Web environment;? p>
(8) allow a user to pretend to be another user (if they allow it);
(9) remember me, which is a very common feature, i.e. log in once and then don't have to log in the next time you come back.
- Previous article:How to become a qualified algorithm engineer?
- Next article:Handmade toy kindergarten is simple
- Related articles
- What is Chinese patent medicine?
- Where can I learn traditional crafts with local characteristics in Guilin?
- High school family style argumentative paper
- Why do people always say they regret tattooing?
- Introduction to Han Dynasty Costumes
- Teaching design of Chinese "steps" in the first volume of the second day of junior high school.
- What does incense burner mean?
- Four Love Dramas of Yuan Dynasty
- How about Shaanxi Fire Traditional Culture College?
- What is the sign of the zodiac on December 29th