Tag: @Value
Mock an Autowired @Value field in Spring with Junit Mockito
Mock @Value Field The below example will show you how to mock an Autowired @Value field in Spring with Junit Mockito. Generally you read some configuration values from properties file into Spring bean or component class using @Value annotated attributes but when you want to test such service or component class using Junit test class then it is required to…
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 in a Java class using…
Injecting properties value in Spring
This tutorial will show you how we can auto inject value from properties file in Spring. For this tutorial we will create a standalone maven project in Eclipse. If you already have an idea on how to create a maven project in Eclipse will be great otherwise I will tell you here how to create a maven project in Eclipse….