"Java Development Guide" Spring development in MyEclipse (2)

In the above ( click here to review>> ), we mainly introduced some basic concepts of Spring, Spring project configuration and wizards. This chapter will continue to introduce how to manage multiple projects, Spring configuration editor, etc. Welcome to continue to pay attention~

MyEclipse v2023.1.2 offline version download (Q technical communication: 742336981)

4. Manage multiple Beans and projects

In addition to using the bean profile editor to manage Spring beans, you can also use the Outline view.

Spring development in MyEclipse

Spring Outline

You can also change the outline to a Spring-style outline using the Outline view menu.

Spring development in MyEclipse

Spring Explorer is a filtered tree view that displays all Spring projects in the workspace, along with any beans, configuration sets, and Spring Web Flow elements they may contain.

Spring development in MyEclipse

Spring Explorer view

The view is namespace aware and highly filterable and customizable. To customize a view, click the drop-down arrow on the View toolbar and select Customize View.

Spring development in MyEclipse

Customize filters and content in Spring Explorer views

Spring Explorer views also specifically annotate beans defined through Spring Java Configuration.

Spring development in MyEclipse

Spring Explorer Java configuration support

When seen in the Project Explorer view using the Spring perspective, all Spring projects contain a Spring Elements subproject. This project can be extended to display beans, configuration sets and web flow definitions, just like the Spring Explorer view described above. The ability to view a list of all beans that reference a specific Java class is a key feature.

Spring development in MyEclipse

Project Explorer with Spring Elements节点

As with Spring Explorer, the Spring elements displayed in this view can be filtered and customized, and you can also use a special Spring working set to reduce clutter in Project Explorer.

Spring development in MyEclipse

Spring work settings

The Graph viewer presents a graphical view of the relationships between the various beans in a given configuration file. Access the graphical view by clicking Beans Graph in the applicationContext.xml file editor.

Spring development in MyEclipse

Spring graphical editor

Use the Open Bean Wizard (ALT+Shift+B) or double-click the bean in the diagram to quickly navigate to any bean.

Spring development in MyEclipse

Navigate to bean

Perform various bean searches and pointcut matching in the workspace from the Search menu on the main toolbar.

Spring development in MyEclipse

Spring development in MyEclipse

Bean pointcut matching search

5. Spring configuration editor

The Spring Config editor is the default editor for Spring bean configuration files.

Spring development in MyEclipse

Spring configuration editor

In addition to standard XML support, Source views provide content assistance for classes, bean IDs, and properties.

Spring development in MyEclipse

Class content assistance

Spring development in MyEclipse

Bean content helper

Spring development in MyEclipse

Attribute content assistance

The Spring configuration editor also supports namespaces and provides intelligent content assistance and validation for defined elements.

Spring development in MyEclipse

AOP namespace content assist

Spring development in MyEclipse

P namespace content assist

Use the visual editor tabs to manage bean entities, editing namespace and bean details for each namespace selected in the configuration. Right-click on an element to add child elements and use the Element Details section to configure the element.

Spring development in MyEclipse

Using the visual Spring Bean configuration editor

To learn more details about the Spring Bean Configuration Editor, scroll to the bottom of the Element details section to access additional documentation.

Spring development in MyEclipse

Access other editor documentation

Renaming a Java class automatically changes the bean definition that references the class. Java classes can also be renamed directly from the bean configuration file.

Spring development in MyEclipse

Rename a bean's Java class

Bean IDs and properties can also be renamed. Renaming bean properties will change the corresponding Java class. The method of renaming an element is as follows:

  • On the Beans tab of applicationContext.xml, select the element and edit the element details.
  • In the Source view of applicationContext.xml, right-click the element and select Refactor>Rename Bean element from the menu.
  • In the Source view of applicationContext.xml, place the cursor inside the element and press ALT+SHIFT+R.

Spring development in MyEclipse

Rename bean ID

Spring development in MyEclipse

Rename bean properties

In addition to standard XML validation, the editor performs spring-specific validations that can be controlled at the project and workspace level. Validation errors are logged in the profile Source view and detailed in the Problems view.

Spring development in MyEclipse

Verify customization

Spring development in MyEclipse

verify

Guess you like

Origin blog.csdn.net/AABBbaby/article/details/132895191