cdicustom-scope

Custom scope in CDI seems to require beans.xml


I created a custom scope in CDI.

@NormalScope(passivating = false)
@Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE,ElementType.METHOD,ElementType.FIELD})
@Inherited
public @interface MyScope { }

It works only if I had beans.xml with in my deployment. Is this a must?


Solution

  • I have packed custom scope as separate jar and placed beans.xml inside. Now its working fine.