public class Employee {
private String name;
private Address address;
public Employee (Address address) {
this.address=address;
}
}
<property/>
elements@Value("#{nameObj}")
=> Injects value from the properties file@Autowired
=> AUtomatically wires Spring beans into other beans@Resource
@Inject
@Named
@Singleton
@Component
=> Used to mark any class as Spring managed component or bean@Repository
=> Indicates class is a DAO that interacts with the database@Service
=> Indicates class is service in service layer of the application@Controller
=> Indicates that class is responsible for hadling web req & res@Configuration
=> Used to declare a XML file as Spring configuration@Bean
@ComponentScan
=> Used to scan stereotype annotations#{expression}
@ContextConfigurations
=> Defines how to load and configure ApplicationContext for JUnit test, can point to both XML and java files@RunWith(SprintJunit4ClassRunner.class)
@DirtiesContext
=> Indicates the ApplicationContext is dirty@ActiveProfiles
=> Activate one or more profiles for the test cases