Your workspace provides in-line
and quick-fix validations for contexts and dependency injection applications.
About this task
As-you-type validation is supported in CDI-faceted projects.
Procedure
- In the Java EE perspective,
open your class that uses context and dependency injection annotations.
If you add a new annotation, for example, @ApplicationScoped, and right-click on the Quick Fix icon, you can then add the required
imports: The import
javax.enterprise.context.ApplicationScoped; import statement
is added to your class.
- Scoped validation
- Validation is limited to the following built in CDI
scope types:
- @RequestScoped
- @ApplicationScoped
- @SessionScoped
- @ConversationScoped
- @Dependent
- Multiple scope declarations are not allowed on the bean
class, producer methods, or producer fields. Validation flags this
as an error and provides a Quick Fix to correct the problem.
- A subset of validators support the following passivating
scopes:
- @SessionScoped
- @ConversationScoped
These annotations can be declared on session beans and managed
beans. In order for these beans to be passivating-enabled, they must
conform to the rules:
- Type Restriction Validation A managed Bean has a
set of legal bean types which include the java.lang.Object, the bean class, the superclass, and all interfaces it implements
directly or indirectly. You can restrict the set of bean types by
using the @Typed annotation but the restricted set
must be a subset of the legal bean types set, otherwise a validation
error will be issued. No Quick Fix support is provided for this.