コード例 #1
0
  @Bean
  public Calendar googleCalendar() throws GeneralSecurityException, IOException {
    JacksonFactory jsonFactory = JacksonFactory.getDefaultInstance();
    HttpTransport transport = GoogleNetHttpTransport.newTrustedTransport();
    SocialConfig googleConfig = googleSocialConfig();
    HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
    GoogleCredential credential =
        new GoogleCredential.Builder()
            .setTransport(httpTransport)
            .setJsonFactory(jsonFactory)
            .setServiceAccountId(googleConfig.getServiceAccountEmail())
            .setServiceAccountPrivateKeyFromP12File(googleApiAuthResource.getFile())
            .setServiceAccountScopes(Collections.singleton(CalendarScopes.CALENDAR))
            .setServiceAccountUser(googleConfig.getCalendarOwner())
            .build();

    return new Calendar.Builder(transport, jsonFactory, credential)
        .setApplicationName("Techlooper")
        .build();
  }
コード例 #2
0
 @Bean
 public JsonNode vietnamworksConfiguration() throws IOException {
   return new ObjectMapper().readTree(vnwConfigRes.getInputStream());
 }