@Required notesThis note indicates that the Bean attribute must be set at configuration time, through an explicit attribute value defined by a bean, or by automatic assembly, if the Bean property of the @required annotation is not set, the container throws beaninitializationexception.@Autowired notes@Autowired annotations provide finer granularity of control, including where and how automated assembly is done. Its usage, like @required, modifies a se
shared, which does not affect the program's operation, but it gives us code and trouble reading the program.
In addition,spring3 MVC validation is also a bright spot, support JSR303, processing AJAX Requests is more convenient, just a note @responsebody, and then directly return the response text. Send the following code:[Java]View PlainCopy
@RequestMapping (value= "/whitelists")
Public String index (Modelmap map) {
Account account
String ID; /* Bean Class */ private String type; /* Bean property */ private mapnew hashmapA bean includes Id,type, and properties.Then spring starts loading our configuration file, storing the information we have configured in a HashMap, HashMap's key is the Bean Id, Hasmap's value is the bean, Only in this way can we get the animal class through Context.getbean ("Animal"). We all know that
. Describe the bean scopes supported in springThe spring framework supports the following five different scopes:
Singleton: Only one bean instance exists in the spring IOC container, and the bean exists as a single instance.
prototype: A bean can define multiple instances.
Request: A new bean is created each time the HTTP request occurs. This scope applies only to the WEBAPPLICATIONCONTEXT
[Spring tutorial 8] automatic spring assembly and spring tutorial assembly
1. In spring assembly between us, if a bean uses another bean file, the format should be as follows:
That is, when beanA needs to use the accessor to inject B, the above configuration is required.
However, in automatic assembly, if the
, if you need to collaborate with another object (call its method and access its attributes), you do not need to create the called user in the code, it depends on the injection of external containers. Spring dependency injection has almost no requirements on callers and callers. It fully supports the management of dependencies between POJO.
Dependency Injection
Set Value injection: The IoC container uses th
bean can define multiple instances.
Request: A new bean is created each time the HTTP request occurs. This scope applies only to the WEBAPPLICATIONCONTEXT environment.
session: An HTTP session defines a bean. This scope applies only to the WEBAPPLICATIONCONTEXT environment.
globalsession: The same global HTTP session defines a bean. The scope also applies only to webapplicationcontext environments.
The bean default Scope property is 'Singleton'.is the singleton beans in the 26.
The previous blog post explains what AOP is. Learned to write the implementation of AOP, but did not actually use it, this blog post is the application of AOP technology, the focus is the processing of transactions.--whFirst, JdbcTemplate What is JdbcTemplate?Spring provides for manipulating database templates, similar to Dbutils, in layman's terms, we operate the database, and spring also helps us to provi
---restore content starts---Problem: I use the spring framework in a Web application, but some modules or components are not hosted for spring, such as some may be a WebService service class, what if I want to use managed objects in these unmanaged classes? Naturally, we need to get a reference to the Spring container object ApplicationContext, and my idea is tha
return an object that is registered as a bean into the spring application context.37. What is annotation-based container configuration?In contrast to XML files, annotation-type configuration relies on the assembly of bytecode metadata rather than the declaration of angle brackets.Instead of using XML to describe the assembly relationship of a bean, a developer is configured in a direct component class by using annotations on the corresponding class,
bean instance exists in the spring IOC container, and the bean exists as a single instance.
prototype: A bean can define multiple instances.
Request: A new bean is created each time the HTTP request occurs. This scope applies only to the WEBAPPLICATIONCONTEXT environment.
session: An HTTP session defines a bean. This scope applies only to the WEBAPPLICATIONCONTEXT environment.
globalsession: The same global HTTP session defines a bean
This article turns from: Click to open linkSpring official website After the revision, the proposal is through maven and gradle download, for not using maven and Gradle development projects, download is very troublesome, give the spring Framework Jar official Direct Download path: http://repo.springsource.org/libs-release-local/org/springframework/spring/Spring
the container unloads the class.The bean tag has two important properties (Init-method and Destroy-method). With them you can customize the initialization and logoff methods yourself. They also have corresponding annotations (@PostConstruct and @predestroy).29. What is spring's internal bean?When a bean is used only as a property of another bean, it can be declared as an internal bean, in order to define the inner bean, in spring's XML-based configuration metadata, elements can be used within o
Gets the value of a set of radio selected items
var item = $ (' input[@name =items][@checked] '). Val ();
Gets the text of the Select selected item
var item = $ ("select[@name =items] option[@selected]"). Text ();
The second element of the Select Drop-down box is the currently selected value
$ (' #select_id ') [0].selectedindex = 1;
Radio the second element of a radio group is the currently selected
1, the use of technology and version number JDK8.0 Spring 5.0 oauth2.0 redis2.0
2, the project uses MAVEN management. Pom File Add: Dependency> groupId> Org.springframework.cloud groupId> Artifactid> Spring-cloud-starter-security Artifactid> Dependency>
Dependency> groupId> Org.springframework.cloud groupId> Artifactid> Spring-cloud-starter-oauth2 Artifactid> Dep
Spring annotation
1. Preparatory work(1) Import Common-annotations.jar(2) Import schema file file name is Spring-context-3.0.3.release.jar(3) Configuring in the Beans node of XML
2.xml Configuration Work
Note: This configuration implicitly registers multiple processors that resolve annotations, such as:
Autowiredannotationbeanpostprocessor
Commonannotationbeanpostprocessor
Persistenceannotationbeanpost
Http://www.importnew.com/13246.html
Home
All articles
Information
Web
Architecture
Basic technology
Books
Tutorial
I want to contribute
More channels»
-nav Bar- Home all posts information web schema Basic technology books Option value= "http://www.importnew.com/cat/tutorial" > tutorial I want to contribute more channels» -IOS -python -android -Web front end Learn from Me
[Spring] Spring integrates log4j and javaweblog4j in Java Web projects.
You may see this article in [Spring] Spring3.0.5 download, configuration, and Helloworld (click to open the link. If Spring does not integrate log4j directly, the following warning is displayed about Spring
background for RPC remote invocation, we are using Dubbo, Dubbox, and so on. We are ready to try new technology (and perhaps not a new technology at this time) because the community is suspending maintenance and responding to future developments, choosing to use the Spring cloud architecture. In the meantime, the Spring boot project was used to try development and the results were good. So you want to refac
Spring is familiar in the Java world. Not long ago, as a side dish, I still dislike his cumbersome, even think he is superfluous."I don't know what to do with him, except to bring us a bunch of configuration files. "But it seems to have been said that existence is reasonable.Also, he can be so popular, there must be a reason for him, not to mention he seems to be more and more fire. (Spring family barrels h
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.