Skip to Content
Java 9 Dependency Injection
book

Java 9 Dependency Injection

by Nilang Patel, Krunal Patel
April 2018
Intermediate to advanced content levelIntermediate to advanced
246 pages
6h 11m
English
Packt Publishing
Content preview from Java 9 Dependency Injection

Declaring aspect

The first thing in Spring AOP is to decide on and define the aspects. In XML-based configuration, an aspect is conceptualized as a simple Java class that you need to declare as a bean definition in a Spring application context (XML) file. The <aop:aspect> element is used to define an aspect:

    <aop:config>    <aop:aspect id="myLoggin" ref="loggingAspect"></aop:aspect>     </aop:config>    <bean id="loggingAspect"    class="com.packet.spring.aop.aspects.LogginAspect">    </bean>

Since an aspect is a form of Java class, it can be defined as a normal Spring bean, and then can be configured with the ref attribute of the <aop:aspect> element. The state and behavior is associated with fields and methods of the aspect class, while the point-cut ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Pro CDI 2 in Java EE 8: An In-Depth Guide to Context and Dependency Injection

Pro CDI 2 in Java EE 8: An In-Depth Guide to Context and Dependency Injection

Jan Beernink, Arjan Tijms
Dependency Injection

Dependency Injection

Dhananjay Prasanna

Publisher Resources

ISBN: 9781788296250Supplemental Content