[英]Beans.xml and SessionScoped
Today my employeer told me to optimize the web application. 今天,我的员工告诉我优化Web应用程序。 And I want to change all the controllers to @ConversationScoped and only use @SessionScoped for only controllers that I need for all Session.
我想将所有控制器更改为@ConversationScoped,并且仅将@SessionScoped用于所有会话所需的控制器。 When I was changing the first controller to @ConversationScoped.
当我将第一个控制器更改为@ConversationScoped时。 The IDE(Netbeans 7.4) told me that I needed a beans.xml.
IDE(Netbeans 7.4)告诉我,我需要一个beans.xml。 Okay I create the beans.xml and everything that I needed.
好的,我创建了beans.xml以及所需的一切。 When I started to deploy It throw me this message
当我开始部署时,它向我抛出此消息
Same interception type cannot be specified twice on the same class
不能在同一类别上两次指定相同的拦截类型
Then I changed again to @SessionScoped and restart my server(GlassFish 3.1.2) and everything is ok. 然后我再次更改为@SessionScoped并重新启动服务器(GlassFish 3.1.2),一切正常。 Then I only created the beans.xml deploy and threw me again that error msg.
然后,我只创建了beans.xml部署,并再次将错误消息msg扔给我。 Delete the beans.xml, restart server and everything is ok.
删除beans.xml,重新启动服务器,一切正常。 I checked my project and no.
我检查了我的项目,没有。 I don't have two beans.xml.
我没有两个bean.xml。
I found that I have two @PostConstruct in one controller. 我发现我在一个控制器中有两个@PostConstruct。 The strange thing that this error I got it only with beans.xml.
奇怪的是,这个错误我仅通过beans.xml得到了。
If you have two annotations like @PreDestroy @PostConstruct it will trhew you and error. 如果您有两个注解,例如@PreDestroy @PostConstruct,它将使您大跌眼镜并出错。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.