Choose EJB to be injected without recompiling

后端 未结 3 824
离开以前
离开以前 2020-12-21 01:11

Imagine you have two implementations of a @Local interface

@Local
public interface LocalInterface {
}

@Stateless
public class MyFirstImplementa         


        
3条回答
  •  南笙
    南笙 (楼主)
    2020-12-21 02:03

    The method outlined by PedroKowalski is a typical way to do this. Another trick with respect to the "external configuration property", is simply configuring your builder such that only 1 implementation ends up in the jar you generate that holds the EJBs.

    So you don't have to recompile classes or change any source code, but you do have to rebuild your jar to choose another implementation.

提交回复
热议问题