示例:
@Stateless
public class ExampleBean {
private static int counter = 0;
private AnotherBean anotherBean;
public void setAnotherBean(AnotherBean anotherBean) {
this.anotherBean = anotherBean;
counter++; // 错误:不应在此处写入任何 static 字段
}
}