java - What are pros and cons of using Spring in Swing based frontend -


We have a frontend application that uses swings, we use the Spring Framework, but it is currently only used Some beans are used to tie ...

What are the next steps for the maximum use of the spring? Is it worth it for non-web applications?

What will be the advantages and disadvantages?

The advantage of using the spring (or any other dependency-injection) framework is that you ( Hopefully) get loose coupled system, i.e. you do not make the classes examples of your colleagues so that you can easily change the implementation.

This is widely known as inverse-to-control theory (IoC, I also in concrete), and it is a good principle to follow, this means that spring web applications , But can be used in any application that wants to use IoC-container (which is basically spring-core).

Disadvantages: It really depends on how you see things, more code (for injected colleagues, you have to define the entry point), but this also makes the code more qualified ( Entry-points are fast, which you can use to test and use to inject into texts).

Besides, you can not see the code and can see instantly how the collaborators used have been implemented. But it also makes for good code, because you rely on the interface, not the implementation.

You get more config: either in xml-file (old-style spring) or with annotation. Until recently you had to inject (@ etowold) the resources to rely on non-standard spring annotations, but now you can use standard java dependency injection annotation, which means that you can change your code without changing your IoC Can switch spring as a container.

Perhaps your application may have more advantages and disadvantages to use spring, but it should start by deciding that using dependence is a good thing for your application.

P>

And according to your question about swing and spring. In an application I am working, we are using spring to wire the whole application. Various dialogues are injected into their logic (no logic should be (in my opinion) being located with GUI logic) We are using JPA / Hibernate as a database-layer, so we will call our DAO unit manager Creating and using the spring spring to create injection and set up the transaction settings.

Comments