Chapter 8 Spring4 bean scope


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd">
	
	<!--
	 Bean scope:
		 1. There is only one Bean instance in the singleton Spring ioc container, and the Bean exists as a singleton;
		 2. The prototype returns a new instance every time the Bean is called from the container;
		 3. A new Bean is created for each HTTP request;
		 4. The session shares a Bean with the same HTTPSession;
		 5. The global session shares a Bean with the same global session, which is generally used in the Portlet application environment;
		 6. The application shares a Bean with the same Application;
	 -->
	<bean id="dog" class="com.fx.entity.Dog" scope="singleton">
		<property name="name" value="jack"></property>
	</bean>
	
</beans>

Guess you like

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