2014-12-06 45 views
0

顯然與梅勒插件在Java中發送郵件,你開始通過獲取MailerAPI的一個實例:的Java Playframework 2.3 *和MailerPlugin

MailerAPI mail = MailerPlugin.email(); 

在Playframework版本2.7.3,我得到

non-static method email() cannot be referenced from a static context 

MailerPlugin是一個斯卡拉特質。因此我不能實現它,也不知道哪個類可靠地使用/實現了這個特性(在這種情況下,我可以創建一個實例並在其上調用email() ...)。

回答

1

嘗試實例化這樣的:

MailerAPI mailer = Play.application().plugin(MailerPlugin.class).email(); 
+0

'MailerPlugin插件= application.plugin (MailerPlugin.class);'實際返回'null' ...我需要實現它的東西嗎? – raoulsson 2014-12-08 17:40:03