开发者

PlayPlugin onApplicationStart does not work

开发者 https://www.devze.com 2023-04-12 03:23 出处:网络
I try to write a small playframework-module and a plugin in it, and want be sure that it will start when I\'m starting up the application.

I try to write a small playframework-module and a plugin in it, and want be sure that it will start when I'm starting up the application.

[myapp] -- uses --> [registration(module)].[plugin(RegistrtionPlugin)]

There is my plugin class I've put to /src/play/modules/registration int he module source

public class RegistrationPlugin extends PlayPlugin {
    public void onApplicationStart() {
        Logger.info("Yeeha, firstmodule started");
    }
}

I have dependency to this module form my application, when i do pl开发者_如何学Cay deps - it shows me that everything good. Or when i type in console in my app-home folder: play registration:hello - it replies me 'Hello' back.

I've got this code from PlayFramework Cook book (chapter 5), but can not make it working as I expect.


Have you added a play.plugins file to your module src folder configuring the RegistrationPlugin plugin?

The play.plugins of e.g. the spring plugins looks like this:

1000:play.modules.spring.SpringPlugin

You might also take a deeper look at the spring plugin:

At last before the module can be used following command has to be executed:

play build-module


Try to move your RegistrationPlugin to regular /app folder

and don't forget to include path to plugin in /src/play.plugins file.

f.e. 1000:RegistrationPlugin

if RegistrationPlugin is in default package

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号