Applicationcontext.xml (Spring)

Source: Internet
Author: User

Both beans and aspect are commented by way of
<?XML version= "1.0" encoding= "UTF-8"?>  <Beansxmlns= "Http://www.springframework.org/schema/beans"Xmlns:context= "Http://www.springframework.org/schema/context"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"XMLNS:AOP= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP"Xmlns:tx= "Http://www.springframework.org/schema/tx"xsi:schemalocation= "Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/ Spring-beans-4.1.xsd HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP Http://www.springframework.org/schema/aop/sprin G-aop-4.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1. XSD Http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.x SD ">           <!--annotation mode Scan Bean -<Context:annotation-config/>        <!--scan for packages that start with the manager -        <Context:component-scanBase-package= "Manager"/>    <!--enable spring-based annotation support for @aspectj aspects -      <Aop:aspectj-autoproxy></Aop:aspectj-autoproxy>  </Beans> 

The bean is configured via XML, aspect through annotations
<?XML version= "1.0" encoding= "UTF-8"?>    <Beansxmlns= "Http://www.springframework.org/schema/beans"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"XMLNS:AOP= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP"Xmlns:tx= "Http://www.springframework.org/schema/tx"xsi:schemalocation= "Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/ Spring-beans-4.1.xsd HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP Http://www.springframework.org/schema/aop/sprin G-aop-4.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1. XSD Http://www.springframework.org/schema/context ">        <!--enable spring-based annotation support for @aspectj aspects -      <Aop:aspectj-autoproxy></Aop:aspectj-autoproxy>     <BeanID= "XXX"class= "XXX"></Bean>  </Beans>  
Bean through annotations, aspect through XML configuration
<?XML version= "1.0" encoding= "UTF-8"?><Beansxmlns= "Http://www.springframework.org/schema/beans"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"Xmlns:context= "Http://www.springframework.org/schema/context"XMLNS:AOP= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP"xsi:schemalocation= "Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/ Spring-beans-4.1.xsd Http://www.springframework.org/schema/context http://www.springframework.org/schema/c Ontext/spring-context-4.1.xsd HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP Http://www.springframework.org/sch Ema/aop/spring-aop-4.1.xsd ">                      <!--bean creation via annotation -        <Context:annotation-config/>        <!--scan for packages that start with the manager -        <Context:component-scanBase-package= "Manager"/>        <!--configuring AOP through XML -        <Aop:config>                   <!--declare where I want to join the plane -             <Aop:pointcutexpression= "Execution (* find* (..))"ID= "Testpointcut"/>              <!--Declare a slice -                                  <Aop:aspectID= "Aspectjadvice"ref= "Aspectjadvice">                <Aop:beforeMethod= "Dobefore"Pointcut-ref= "Testpointcut"/>                 <Aop:afterMethod= "Doafter"Pointcut-ref= "Testpointcut"/>                  <Aop:aroundMethod= "Doaround"Pointcut-ref= "Testpointcut"/><!--must have a return attribute --                 <aop:after-returningMethod= "Doreturn"returning= "RetVal"Pointcut-ref= "Testpointcut"/> <!--must have throwing properties-->                <aop:after-throwingthrowing= "Ex"Method= "Dothrowing"Pointcut-ref= "Testpointcut"/>                             </Aop:aspect>        </Aop:config>        </Beans>

Applicationcontext.xml (Spring)

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.