Ews(Exchange Web Services-mIcrosoft)Java Api,在Spring中创建ExchangeService Bean

时间:2017-09-20 06:22:43

标签: spring exchangewebservices

我在Spring休息时使用EWS Java Api,我已经为整个应用程序使用了特定的一个用户凭证,实际上我只需要从这个用户的收件箱中获取邮件。

所以这里是因为我有一个特定的用户,所以每次我刚刚创建一个ExchangeService bean时,不要创建ExchangeService实例(新的ExchangeService())。

 @Bean
    public ExchangeService exchangeService() throws Exception {
        ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
        ExchangeCredentials credentials = new WebCredentials("email", "password");
        service.setCredentials(credentials);
        service.autodiscoverUrl(username, new RedirectionUrlCallback());
        return service;
    }

所以我在这里有一些问题:

  • 创建一个swapService bean是个好主意,因为我不确定ExchangeService的过期时间限制吗?
  • exchangeService是否有任何特定的过期时限?

0 个答案:

没有答案