spring container managed beans

 

Without spring container managed beans, we get an object and need to manually new

 

With spring management, the beans we need are obtained directly from the spring container

There is an applicationContext.xml (used to configure beans) that needs to have constraint headers

Then load the config file

After loading, start the container, let the container read the configuration file, and then get the bean from the container

 

step:

1. Prepare the jar package spring-beans-4.1.2.RELEASE.jar spring-core-4.1.2.RELEASE.jar and add: com.springsource.org.apache.commons.logging-1.1.1.jar

2. Develop the HelloWorld program

3. Complete the configuration in applicationContext.xml (xsd-config.html)

4. Start the container

5. Get the bean from the container

6. Invoke the method of the bean response

 

Report ClassNotFound, there are generally two cases, either the package is not imported, or the wrong package is imported

There are two types of constraint headers, one is dtd and the other is schema

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326868152&siteId=291194637