62 | | The '''Spring framework''' is used to define '''beans''' for singleton service objects, which are injected into various components throughout the application. The [source:/VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/webapp/WEB-INF/applicationContext.xml applicationContext.xml] file bootstraps the bean definition, while most beans are discovered en constructed by means of 'component scanning'. For example, a singleton bean for ''!DataStore'' exists because it is annotated ''@Repository''. The instance is made available in the ''!VirtualCollectionRegistry'' and ''Application'' (for the Wicket UI) instances because both are managed by Spring too (annotated with ''@Service'' and ''@Component'' respectively) and contain a ''!DataStore'' field annotated with ''@Autowired''. |
| 62 | The '''Spring framework''' is used to define '''beans''' for singleton service objects, which are injected into various components throughout the application. The [source:/VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/webapp/WEB-INF/applicationContext.xml applicationContext.xml] file bootstraps the bean definition, while most beans are discovered en constructed by means of 'component scanning'. For example, a singleton bean for ''!DataStore'' exists because it is annotated ''@Repository''. The instance is made available in the ''!VirtualCollectionRegistry'' and ''Application'' (for the Wicket UI) instances because both are managed by Spring too (annotated with ''@Service'' and ''@Component'' respectively) and contain a ''!DataStore'' field annotated with ''@Autowired''. |
| 63 | In addition, some beans are defined in configuration classes (annotated with ''@Configuration''), by methods annoted ''@Bean''. Note that all beans are singleton by default - so called 'prototype beans' are not used in the VCR. |
| 64 | |
| 65 | There are a number of application context '''profiles''', the activity of which determine which beans get instantiated by Spring. The context parameter ''spring.profiles.active'' can be used to activate one or more profiles. The profiles are defined by means of the ''@Profile'' annotation. At the moment one profile exists for each PID provider implementation; for example, the ''vcr.pid.epic'' profile activates the ''EPICPersistentIdentifierProvider'' implementation and the ''EPICPersistentIdentifierConfiguration'' configuration. It is technically valid to activate multiple profiles but in this case this will lead to a clash of service implementations. See deployment information for more details on using profiles to select the PID provider for a VCR instance after deployment. |