use of io.micronaut.runtime.event.annotation.EventListener in project micronaut-gcp by micronaut-projects.
the class GoogleClientExample method onStartup.
@EventListener
public void onStartup(StartupEvent event) {
AccessSecretVersionResponse response = client.accessSecretVersion(AccessSecretVersionRequest.newBuilder().setName(SecretVersionName.of("my-cloud-project", "secretName", "latest").toString()).build());
String secret = response.getPayload().getData().toStringUtf8();
}
use of io.micronaut.runtime.event.annotation.EventListener in project micronaut-starter by micronaut-projects.
the class GenerationListener method onApplicationGenerated.
@EventListener
void onApplicationGenerated(ApplicationGeneratingEvent event) {
GeneratorContext context = event.getSource();
List<SelectedFeature> features = context.getFeatures().stream().map(SelectedFeature::new).collect(Collectors.toList());
Generated generated = new Generated(context.getApplicationType(), context.getLanguage(), context.getBuildTool(), context.getTestFramework(), context.getJdkVersion());
generated.setSelectedFeatures(features);
if (analyticsOperations != null) {
analyticsOperations.applicationGenerated(generated).whenComplete((httpStatus, throwable) -> {
if (throwable != null) {
if (LOG.isErrorEnabled()) {
LOG.error("Error occurred reporting analytics: " + throwable.getMessage(), throwable);
}
}
});
}
}
Aggregations