@Value

Mock an Autowired @Value field in Spring with Junit Mockito

Introduction The below example will show you how to mock an Autowired @Value field in Spring with Junit Mockito. Generally we read some configuration values from properties file into Spring bean or component class using @Value annotated attributes but when we want to test such service or component class using Junit test class then it […]

Spring AOP – AspectJ Annotation Example

In my previous tutorial I have shown how to write Spring AOP using XML configuration and in this tutorial I am going to show you how to write Annotation based Spring AOP using @AspectJ. This example creates annotation examples with @Aspect, @Pointcut, @Before, @After, @Around, @AfterReturning, @AfterThrowing Advice. @AspectJ is a style to declare aspects […]

Scroll to top