shoppingcartinterceptor.java

来自「想学习EJB的同学」· Java 代码 · 共 42 行

JAVA
42
字号
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package ejb3.day2;import javax.annotation.PostConstruct;import javax.annotation.PreDestroy;import javax.ejb.Init;import javax.ejb.PostActivate;import javax.ejb.PrePassivate;import javax.interceptor.InvocationContext;import static java.lang.System.out;/** * * @author user */public class ShoppingCartInterceptor {    @PostConstruct    public void constructed(InvocationContext ctx) {        out.println("PostConstruct: " + ctx.getTarget().getClass().getName());    }        @PreDestroy    public void beforeDestroy(InvocationContext ctx) {        out.println("BeforeDestroy: " + ctx.getTarget().getClass().getName());    }    @PrePassivate    public void beforePassivate(InvocationContext ctx) {        out.println("beforePassivate: " + ctx.getTarget().getClass().getName());    }    @PostActivate    public void activated(InvocationContext ctx) {        out.println("activated: " + ctx.getTarget().getClass().getName());    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?