Overview
Other MyFaces Extensions
- ExtVal
- Ext-Script
- [Orchestra]
- [Portlet Bridge]
Community
Development
Sponsorship
Your browser does not support iframes
...
CODI provides multiple hooks for the startup. Usually it's enough to observe the StartupEvent
fired by CODI during the startup-process as soon as the target environment is up and running. In case of JSF this event is fired lazily. If you need to execute custom logic before CODI gets active, you should have a look at the dev guide (see StartupEventBroadcaster
).
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
@ProjectStageActivated({Development.class, IntegrationTest.class})
public class SampleDataStartupObserver
{
protected void createSampleData(@Observes StartupEvent startupEvent, UserRepository userRepository)
{
User user = new User("Demo", "User");
userRepository.save(user);
}
}
|
For creating instances of Annotations, you can use the literal trick. A custom implementation allows to provide custom values (see e.g. the NamedLiteral which is used by CODI internally). If you are fine with the default values of an annotation, you can use DefaultAnnotation
to create an annotation for a given type, instead of a custom literal implementation.
...