In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is to share with you about the new features of Spring2.0. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
New features of Spring2.0 1. XML configuration of Spring introduces XML Schema syntax to simplify configuration
In the Spring1.x series, the configuration file for bean uses DTD and there is no separation of namespace. A very big improvement in 2. 0 is the introduction of XML Schema's namespace, so that the configuration file of bean can be greatly simplified. These simplifications include various simplification of bean properties, simplification of AOP configuration, simplification of transaction configuration, simplification of JNDI configuration and so on. Of course, while simplifying the configuration, the new XML Schema actually introduces more XML syntax, so it is necessary to use a XML Editor that supports XML Schema. For example, Eclipse WTP can provide automatic syntax prompt and validation of Schema.
The bean configuration file of Spring1.x is becoming more and more complex and trivial, which is one of the main problems that Spring has always been stigmatized by people. The configuration of XML Schema syntax in Spring2.0 can reduce the complexity and complexity of configuration files to a considerable extent, which can be regarded as one of the major improvements of Spring. But we must also see that XML Schema does not solve the problem of complex XML configuration from the root, but only alleviates it.
Using XML to describe all the dependencies and assembly relationships between bean will make it difficult for XML to read and modify. And unit tests cannot be done directly to verify dependencies with the XML configuration itself. Therefore, the more complex the relationship between bean, the maintenance of the XML configuration file itself is also a burden.
I personally expect that the future Spring will be able to use scripting languages to write and assemble relationships between bean, so that the assembly script itself is testable, and the script is far better descriptive than the XML configuration file, and easier to write and maintain than XML.
New features of Spring2.0 2. Bean in the range of request and session
The introduction of request scope and session scope's bean, I feel like a double-edged sword. For ordinary Java Web framework applications, the operations related to the Servlet container should be limited to the Web layer, and for the business layer, the scope of request and session should not be involved, otherwise the business layer code cannot be unit tested without the Servlet container. Users of the Webwork/Struts framework are unlikely to use this feature, and as far as I understand it, maybe request/session scope's bean is also intended for Spring MVC's Controller use.
In addition, this feature is useful for AJAX Web Service calls. For this application scenario, JS calls through AJAX, puts aside the Web layer framework and directly accesses the business layer bean. At this time, you need to provide the bean of request/session scope.
New features of Spring2.0 3. Integrated AspectJ, which can manage objects outside the container and provide dependency injection of domain model.
The persistent object PO, which is usually managed by Hibernate, is not initialized by the Spring container, but is often new by the user or created by the find,load method. As a result, the Spring container cannot inject bean dependencies into objects created outside the container.
In Spring2.0, you can use AspectJ to statically weave the domain model, so that when the domain model is created outside the container, a callback to the container will be generated for dependency injection.
This feature provided by Spring2.0 ensures the feasibility of Martin Folwer Rich Domain Object. I am afraid that the provision of this feature will have a profound impact on the design of many Java systems in the future.
In fact, for Rich Domain Object further, if the DAO function as the abstract parent class of Domain Object, then the persistence object PO will gather PO,DAO,Service objects in one, the entire business layer, persistence layer will be completely merged into one object, the result of framework simplification in this way is highly similar to ruby on rails's full-stack MVC framework.
New features of Spring2.0 IV. JPA support
There is nothing to comment on this, and it is only natural to provide JPA support.
New features of Spring2.0 5. NamedParameterJdbcTemplate of JDBC
NamedParameterJdbcTemplate makes a lot of sense to me, providing placeholders with named parameters for JDBC queries, not just JDBC's own "?" In this way, when using JDBC, it is also easy to construct a dynamic conditional query with placeholders instead of concatenating SQL strings with parameter values.
New features of Spring2.0 VI. Substantial expansion of Spring Web MVC functions
It can be seen that the Web MVC function in Spring2.0 has been greatly expanded, the UI Taglib that has not been provided in the past has finally been provided, and the configuration file has been simplified as necessary. Although Spring MVC is not as creative as Webwork from the perspective of framework design, it is also a step-by-step improvement. Coupled with the support of various peripheral frameworks such as Spring Webflow, it can be predicted that Spring MVC will grow into a strong competitor to Webwork.
New features of Spring2.0 VII. Support for dynamic language ruby,groovy,beanshell
At present, dynamic language support seems relatively simple and not powerful enough, but it shows the attitude of Spring. In fact, I personally hope that Spring can strengthen this support, or even boldly provide bean assembly configuration written in dynamic scripting language.
New features of Spring2.0 VIII. Asynchronous JMS support, JMX support, JCA support
Spring2.0 itself provides two kinds of simple JMS Containter, in addition, it also provides the interface of external JMS Server. In addition, the support of JMX function and JCA function are in the process of further improvement.
The functional support of Spring2.0 in these aspects is not so eye-catching, after all, ordinary Java Web applications rarely use these aspects. However, the perfect support of these functions provided by Spring is of far-reaching significance, because these functions are required by the J2EE specification, and they are also the traditional advantage projects of traditional application server manufacturers compared with Java open source framework. Once Spring2.0 provides complete support for these functions, the technical obstacles to completely migrating traditional Java enterprise applications to the Spring framework will be removed.
Therefore, Spring is an ambitious framework, from the current situation, Spring can be said to be the aggregator of the Java open source framework, from the future, Spring will provide all the necessary functions that J2EE vendors can provide, and eventually Spring will be possible to take the J2EE specification and replace it, becoming the factual platform and de facto standard developed by Java enterprises.
Thank you for reading! This is the end of this article on "what are the new features of Spring2.0?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.