java - Does cdi producer take class scope -


hello question produce example on applicationscoped bean produces instances applicationscoped? take class scope or dependent?

the specification treats producer methods beans (basically, producer definiton of how create instance of given bean type). therefore rule applies, if no scope provided, @default assumed.

hence answer question - the producer scope @default if none specified. there no link between producer scope , scope of bean on declared.

@applicationscoped public mybean {    @produces //this produce @dependent   public foo producedependent() {     return new foo();   }    @produces   @requestscoped //produces scope define   public bar producereqscopedbean() {     return new bar();   } } 

Comments