2017-10-15 84 views
0

我剛把項目從Windows移到Ubuntu。在Windows上的程序運行良好,但我在Ubuntu得到這個錯誤:無法找到Org.springframework.mail.javamail.JavaMailSender類型的Bean?

型Org.springframework.mail.javamail.JavaMailSender的豆找不到

下面是代碼,以及如何我已經使用它。它適用於Windows沒有使用Ubuntu和收到此錯誤

@Autowired 
    private JavaMailSender mailSender; 

     User user = userService.findByUsername(principal.getName()); 

     Order order = orderService.createOrder(shoppingCart, shippingAddress, billingAddress, payment, shippingMethod, user); 

     mailSender.send(mailConstructor.constructOrderConfirmationEmail(user, order, Locale.ENGLISH)); 

     shoppingCartService.clearShoppingCart(shoppingCart); 

     LocalDate today = LocalDate.now(); 
     LocalDate estimatedDeliveryDate; 

*************************** 
APPLICATION FAILED TO START 
*************************** 

Description: 

Field mailSender in com.bookstore.controller.CheckoutController required a bean of type 'org.springframework.mail.javamail.JavaMailSender' that could not be found. 
    - Bean method 'mailSender' not loaded because AnyNestedCondition 0 matched 2 did not; NestedCondition on MailSenderAutoConfiguration.MailSenderCondition.JndiNameProperty @ConditionalOnProperty (spring.mail.jndi-name) did not find property 'jndi-name'; NestedCondition on MailSenderAutoConfiguration.MailSenderCondition.HostProperty @ConditionalOnProperty (spring.mail.host) did not find property 'host' 


Action: 

Consider revisiting the conditions above or defining a bean of type 'org.springframework.mail.javamail.JavaMailSender' in your configuration. 

我認爲它具有抗病毒的事,在窗戶我不得不解散能抗病毒,但Ubuntu的我該怎麼辦?

+0

您是否移動了每個文件?你能發佈有用的代碼嗎?事實上,這不可能幫助你解決問題。 – araknoid

回答

0

你是否已經遷移了你的application.properties?

由於@ConditionalOnProperty註釋,未加載該Bean。它期望其他bean/proprties首先被初始化,這受application.properties中的值的控制。屬性

+0

會檢查@vineet Chauhan – valik

相關問題