2017-10-15 3 views
0

Je viens de déplacer mon projet de Windows vers Ubuntu. Sous Windows, le programme fonctionne très bien, mais je reçois cette erreur dans Ubuntu:Bean de type Org.springframework.mail.javamail.JavaMailSender n'a pas pu être trouvé?

Bean de type Org.springframework.mail.javamail.JavaMailSender n'a pas pu être trouvé

est sous le code et comment i l'ai utilisé. et il fonctionne sur Windows n'utilisant Ubuntu et obtenir cette erreur

@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. 

Je pense qu'il doit faire avec anti-virus, dans les fenêtres que je devais dis en mesure anti-virus mais Ubuntu Que dois-je faire?

+0

Avez-vous déplacé tous les fichiers? Pouvez-vous poster du code utile? Comme c'est le cas, il est impossible de vous aider à résoudre le problème. – araknoid

Répondre

0

Avez-vous migré votre application.properties?

Le bean n'est pas chargé en raison de l'annotation @ConditionalOnProperty. Il s'attend à ce que d'autres beans/proprties soient initialisés en premier ce qui est gouverné par les valeurs dans l'application. Properties

+0

vérifiera que @vineet Chauhan – valik