SEAM:有效使用@BypassInterceptors?

Sha*_*man 7 java performance annotations seam interceptor

我想知道在使用@BypassInterceptorsSeam进行编程时社区可以给我什么建议使用注释?我一直在阅读增加Seam应用程序性能,并且每篇文章都提到添加此注释可以提高性能.我的问题是,应该在哪里应用?是否有一般规则说"在编写可以安全应用XXX的组件时@BypassInterceptors"?例如,我应该将它应用于我的实体类吗?DAO怎么样?我很想知道其他人在做什么,以及你在正确应用它时会看到什么样的性能提升.

Art*_*ald 9

如果您确定不需要拦截器功能,则可以依赖@BypassInterceptor注释来禁用拦截器.功能包括

等等...

因为通过使用反射(运行时)来实现双向功能 - 例如,请参阅此问题,您可以了解反射可以添加多少性能开销 - 可以通过使用来避免(除了@BypassInterceptor)

•Component.getInstance(<COMPONENT_NAME_GOES_HERE>)

•getter和setter's

如果你有

@Name("personManager")
public class PersonManager {

    private @In Person person;

}

<h:inputText value="#{person.name}"/>
Run Code Online (Sandbox Code Playgroud)

您可以代替@In注释

@Name("personManager")
public class PersonManager {

    private Person person;

    public Person getPerson() {return this.person;}
    public void setPerson(Person person) {this.person = person;}

}
Run Code Online (Sandbox Code Playgroud)

但不要忘记(注意它的最新值属性)

<h:inputText value="#{personManager.person.name}"/>
Run Code Online (Sandbox Code Playgroud)