Spring / Spring7 basics Interview questions
Define an Aspect in Spring AOP?
An Aspect is a module that captures a cross-cutting concern - logic like logging, security checks, or transaction handling that would otherwise be scattered across many unrelated classes - and applies it declaratively at defined points in the program, called join points.
@Aspect @Component public class LoggingAspect { @Before("execution(* com.shop.service.*.*(..))") public void logCall(JoinPoint jp) { System.out.println("Calling: " + jp.getSignature()); } }
An aspect is defined by combining a pointcut expression, which selects which join points to match, with advice, which is the code to run at those points. Spring implements aspects using proxies by default, so AOP only intercepts calls that go through a Spring-managed bean reference, not internal method-to-method calls within the same class.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
