Lin Bingwen Evankaka Original works. Reprint please specify the source Http://blog.csdn.net/evankakaBased on Java configuration options, you can write most of the spring without configuration XML, but with the help of several Java-based annotations explained. Starting with Spring3.0, we support the use of Java code instead of XML to configure spring, and
Based on Java configuration options, you can write most of the spring without configuration XML, but with the help of several Java-based annotations explained. Starting with Spring3.0, we support the use of Java code instead of XML to configure spring, and Java-based configuration provides many of the benefits that spr
Java uses generics to transform the Bean class and map, and the use of generics can bring many benefits:The first is type safety, the type safety of Java programs. By knowing that generics are used, these assumptions exist only in the programmer's mind (or, if you're lucky, in code comments).generics allow the compiler
Java class to obtain the bean of the Spring container
There are many ways to obtain beans in Spring. Here we will summarize:
First: Save the ApplicationContext object during initialization
ApplicationContext ac = new FileSystemXmlApplicationContext("applicationContext.xml");ac.getBean("beanId");Note: This method is applicable to standalone applications using the
inherits or implements the corresponding classes or interfaces in a normal class, you can get the ApplicationContext object of spring. However, it is important to note that the normal Java class that inherits or implements these abstract classes or interfaces must be configured in the spring's configuration file (that is, the Application-context.xml file), other
Java Test class Gets the spring Bean methodhttp://blog.163.com/lizhenming_2008/blog/static/76558333201362094243911/1. Through the spring contextApplicationContext ctx = new Classpathxmlapplicationcontext ("Applicationcontext.xml");DataSource ds = (DataSource) ctx.getbean ("DataSource");2, Resource classResource rs = new Filesystemresource ("**/**/appliactionconte
With SSM projects, many Service,dao are defined using annotations, and ordinary Java classes get to these beans, which can be written like this: Public class Common { private userservice userservice; Public Common () { @SuppressWarnings ("resource") abstractapplicationcontext ctx New Classpathxmlapplicationcontext (new String []{"Classpath:spring-mvc.xml", "Classpath
The Bean class in Spring configuration uses the meaning of the factory bean to parseThe beautiful Life of the Sun Vulcan (http://blog.csdn.net/opengl_es)This article follows "Attribution-non-commercial use-consistent" authoring public agreementReprint Please keep this sentence: Sun Vulcan's Beautiful Life-this blog focuses on Agile development and mobile and IoT
In Spring configuration, the bean class uses the factory Bean meaning for parsing. springbean
Parsing the meaning of factory bean used by Bean class in Spring Configuration
Beautiful Life of the sun and fire god (http://blog.csdn
Diagram of the spring container, bean configuration information, bean implementation class, and application four:Bean configuration information defines the implementation and dependencies of the bean, and the spring container establishes the Bean definition registry within t
SpringMVC conflicts with existing, non-compatible bean definition of same name and class solution, springmvc obtains beanCause
Recently, a colleague from the project team encountered a problem. The module he was responsible for, SpringMVC Controller, and the Controller class names of other modules were duplicated, causing the whole project to fail.
The following
Examples on the official website
JSON-lib is a Java class package used to convert beans, maps, and XML into JSON and convert JSON back to bean and dynabean.: Http://json-lib.sourceforge.net/The third-party package is also required:Org. Apache. commons (version 3.2 or later)Org. Apache. oroNet. SF. ezmorph (ezmorph-1.0.4.jar)Nu. XOM1. ListJava code
Boolean[] Boo
public class Apputil implements Applicationcontextaware {private static ApplicationContext appctx;
/** * This method can inject the ApplicationContext object into the current class as a static member variable.
* * @param applicationcontext ApplicationContext Object * @throws org.springframework.beans.BeansException * * public void Setapplicationcontext (ApplicationContext applicationcontext) throws
Spring also has an abstract bean. You only need to set the abstract attribute to true in the configuration file. It does not configure the class attribute because it will not be instantiated. When the bean of another spring inherits the abstract bean, You need to configure its parent attribute. If the parent
1.spring MVC returns JSON data and only needs to return a Java Bean object, as long as the Java Bean Object implements serialization Serializeable2.@RequestMapping (value = {"/actor_details"}, Method ={requestmethod.post}) @ResponseBody Publicresultobject actordetails (@RequestBody actordetailsrequest req) {logger.debu
is really 114 pagesHe said: "Boss, we are an open-source community, we have to make full use of everyone's power, so I did not do things like VB and Delphi, instead, I define a set of specifications, as long as you follow this specification, who can use Java to make visual development tools like VB." ”"What exactly is the specification of this Java bean?" he sai
equivalent Java code. You will use a java-based configuration to define the bean specified above. We will replace the XML with the Java class, which will now be used as a platform for the bean configuration. We'll name this
Read the summaryThe final draft of the EJB 3.0 specification has been submitted to JCP, and EJB3.0 will be officially released in 2006 if not unexpectedly. This article, the first in the common draft three series of EJB 3.0, explains the basic concepts of EJB 3.0 and enterprise bean components, and you learn how to use JBoss and MAVEN to develop enterprise-class bea
OverviewIt is well known that the Spring framework is a driver of the control inversion (IOC) or Dependency injection (DI) pattern, which is implemented through container-based configuration. In the past, Spring allowed developers to use XML-based configuration to manage bean dependencies by leveraging application context XML files. This file is outside the application and contains definitions for the bean
Bean's Chinese meaning is "beans", as the name implies JavaBean is aJava applet。 JavaBean actually refers to a special Java class that is typically used toimplement some of the more common simple functions, and can be easily reused or inserted into other applications. All Java classes that follow certain programming principles can be called JavaBean.I.
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.