Java – spring swing integration

Spring does not work well with beans created outside the application context

What is the best way for me to use jform designer to design forms and then use spring to manage the operation of components?

There are several ways to integrate spring and swing (for example https://www.ibm.com/developerworks/java/tutorials/j-springswing/ )However, this method needs to extend every control you want to use, which seems to add a lot of unnecessary overhead This method also does not allow me to use jform designer to simulate the appearance of the form

I also looked at the spring rich client project, but it seems that it has not been migrated to spring 3, although it seems likely to be redeveloped soon, because they have transferred the project hosting to GitHub

Solution

I have an application that uses swing, jform designer to build panels, spring and spring RCP There is a view class that extends RCP's abstractview for each view. It references panels (we call them) and actions, so it can manage them Each view has a main panel (which can be built using jform designer), which is the panel referenced by the view I don't know if this is the best way, but it works well

The main problem I encountered is that if you want them to be spring beans, defining a simple listener that references the panel requires too much configuration If you do not, you must manually pass references to all required spring resources (panels, service interfaces, etc.), which is also a lot of work I have solved this problem by writing the static getter of the most common spring bean to a class that can access the application context

What's wrong with configuring spring to manage actions and forms? In our application, the panel has been simply defined as the properties of the view in the application configuration, which is nothing special

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>