Beans.xml 和 SessionScoped

Beans.xml and SessionScoped

今天我的员工告诉我要优化网络应用程序。我想将所有控制器更改为@ConversationScoped,并且仅将@SessionScoped 用于所有会话所需的控制器。当我将第一个控制器更改为@ConversationScoped 时。 IDE(Netbeans 7.4) 告诉我我需要 beans.xml。好的,我创建了 beans.xml 和我需要的一切。当我开始部署时,它向我抛出这条消息

Same interception type cannot be specified twice on the same class

然后我再次更改为@SessionScoped 并重新启动我的服务器(GlassFish 3.1.2),一切正常。然后我只创建了 beans.xml 部署并再次向我发送错误消息。删除beans.xml,重启服务器,一切正常。我检查了我的项目,没有。我没有两个 beans.xml。

我发现我在一个控制器中有两个@PostConstruct。奇怪的是这个错误我只用 beans.xml 得到它。

如果你有两个注解,比如@PreDestroy @PostConstruct,它会处理你并出错。