Keeping beans and BeanInfo classes in different packages in the same project

When you develop classes in the Visual Editor for Java, you have the option to keep your .java files and BeanInfo classes in different packages within the same project. The advantage of doing this, compared to having them in the same package, is that by decoupling design and runtime classes you can deploy them separately.

To accomplish this, you must edit the properties of the Java project to configure the BeanInfo search path that the Visual Editor uses.

For example, a project called MyProject contains the following packages:

To configure the setup just described:

  1. Switch to the Java perspective.
  2. Right-click the project that contains both packages, for example MyProject, and select Properties from the pop-up menu.
  3. Select BeanInfo Path from the list of properties.
  4. On the Packages page, make sure the Enable BeanInfo Introspection on this Project checkbox is selected. Otherwise, no information in the BeanInfo path will be used by the introspector at any time for the project.
  5. Click the Choose packages push button and select one or more packages in the same project that contain the BeanInfo classes
  6. (Optional) If you want to change the order in which packages are searched during introspection, click the Order and export tab and use the Up and Down buttons. During introspection the rules for finding a suitable BeanInfo class for a Java bean are applied to each package in turn. Changing the order of packages is required only if there are two or more possible BeanInfo classes that may be candidates for the same Java bean class.
  7. If you want these packages to be included in the BeanInfo search path for classes in other Java projects that reference classes in this project (and therefore include this project in their Java build path), the package that contains the BeanInfo classes must be exported. Confirm the following settings:
    1. Still editing the BeanInfo Path properties, click the Order and export tab and make sure the packages that contain the BeanInfo classes are selected for export. This is the default.
    2. Select the Java Build Path properties for the same project and confirm that the packages containing the BeanInfo classes are not excluded from export there. Excluding them here would override including them on the BeanInfo Path page.

When the introspector is created for the project, it includes all packages specified in the Packages list in its search path.

Related concepts
BeanInfo classes and introspection

Related tasks
Specifying the location of BeanInfo classes

Related reference
BeanInfo classes for JRE classes
BeanInfo classes for the Visual Editor for Java

(C) Copyright IBM Corporation 2000, 2003. All Rights Reserved.