advantages of the spring framework
1. Using spring's IOC container, the dependencies between the objects are given to spring, and the coupling between the components is reduced, allowing us to focus more on the application logic
2. Can provide many services, transaction management, WS and so on.
3.AOP is very good support, instant noodles programming to the plane.
4. The mainstream framework provides good integration support, such as HIBERNATE,STRUTS2,JPA
The 5.Spring di mechanism reduces the complexity of business object substitution.
6.Spring is a low-intrusion, very low code pollution.
The 7.Spring is highly open and does not force reliance on spring, and developers are free to select part or all of spring
terminology of AOP
Aspect (Aspect): Refers to a functional component that encapsulates common processing. The component can act on the method of a batch of target components.
Connection point (Joinpoint): Refers to the way in which the facet component and the specific target component are related.
Pointcut (Pointcut): An expression used to specify the target component. Refers to the aspect component and which batch of target component methods are related
Notification (Advice): Used to specify the timing of the action between the facet component and the target component method. For example: Perform the aspect component before executing the target method, or first execute the target method and execute the facet component.
Target: Use the components and methods specified by the pointcut.
Dynamic Agent (Autoproxy): Spring also uses dynamic proxy technology to implement the AOP mechanism. When AOP is used, the target component obtained from the container Getbean () returns a dynamically generated proxy class. Then execute the business method through the proxy class, the proxy class is responsible for invoking the aspect component function and the original target component function.
To configure a data source by using a property file
<!--introducing the properties file --
<bean
class= "Org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" >
<property name= "Location" >
<value>classpath:database.properties</value>
</property>
</bean>
<!--configuring data sources -
<bean id= "DataSource" class= "Org.apache.commons.dbcp.BasicDataSource "
destroy-method= "Close" >
<property name= "Driverclassname" value= "${driver}"/>
<property name= "url" value= "${url}"/>
<property name= "username" value= "${username}"/>
<property name= "password" value= "${password}"/>
</bean>
Attention:!!! In the ${...} Pay attention to the blank spaces or other special symbols! Otherwise, I can't read it.
Spring Casual Summary