LoginSignup
3

More than 5 years have passed since last update.

インターセプターの優先順位

Posted at

play1 には下記四種類のインターセプターが用意されています。

  • @Before
  • @After
  • @Check
  • @Finally

同じインターセプターを複数個設定した場合の実行順序について、ドキュメントには @Check のみ記載がありますが、これら全てのインターセプターで priority 属性が指定できます。

public class SomeController extends Controller {

    @Before(priority = 0)
    public static void highPriorityMethod() {
        Logger.debug("this method should be called first.");
    }

    @Before(priority = 1)
    public static void lowPriorityMethod() {
        Logger.debug("and then, this method will be called.");
    }
}

参考

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3