[JAVA] What are the advantages of DI and Thymeleaf?

Overview

"Spring" is one of the two major Java frameworks today. I will explain what are the major features of this framework, DI (Dependency Injection) and Thymeleaf.

Advantages of DI

DI is to externally set the information required for the formation requirements of an object. For example, if you have the following situation:

Class A → Class B
Class A has a dependency on class B (class B has a dependency on class A)

When DI is applied, the class B information required for class A is cut out to the outside, so the situation of class B can be ignored and class A can be executed.

In other words, there is no such thing as "I can't test class A because there is still an error in class B". This is the advantage of DI.

Benefits of Thymeleaf

Thymeleaf is a template engine that is used as standard in Spring Boot. Since Thymeleaf describes the variable part with the attribute value, it does not collapse even if it is displayed on the browser.

So, "If you modify the design, it will not work. However, if you modify the function so that it works normally, the design will collapse." This is the advantage of Thymeleaf.

References

https://www.atmarkit.co.jp/ait/articles/0504/29/news022.html https://javazuki.com/articles/thymeleaf-introduction.html

Recommended Posts

What are the advantages of DI and Thymeleaf?
What if the results of sum and inject (: +) are different?
What are the updated features of java 13
[For beginners] DI ~ The basics of DI and DI in Spring ~
[Technical memo] About the advantages and disadvantages of Ruby
Advantages and disadvantages of Java
'% 02d' What is the percentage of% 2?
What are the rules in JUnit?
[Java] What are overrides and overloads?
A brief summary of DI and DI containers
What you are doing in the confirmation at the time of gem update
Folding and unfolding the contents of the Recyclerview
About the operation of next () and nextLine ()
What is the data structure of ActionText?
About the mechanism of the Web and HTTP
What is JSP? ~ Let's know the basics of JSP !! ~
Check the version of the JDK installed and the version of the JDK enabled
Think about the combination of Servlet and Ajax
I compared the characteristics of Java and .NET
What is the difference between SimpleDateFormat and DateTimeFormatter? ??
Learn the rudimentary mechanism and usage of Gradle 4.4
About next () and nextLine () of the Scanner class
[Java] What to do if the contents saved in the DB and the name of the enum are different in the enum that reflects the DB definition
ArrayList and the role of the interface seen from List
Existence check of has_many and belongs_to-optional: What is true?
What is the difference between a class and a struct? ?? ??
Please note the division (division) of java kotlin Int and Int
The comparison of enums is ==, and equals is good [Java]
What is the difference between System Spec and Feature Spec?
[Grails] About the setting area and the setting items of application.yml
Convert the array of errors.full_messages to characters and output
Organizing the current state of Java and considering the future
Java language from the perspective of Kotlin and C #
[CentOS] Download and build the specified version of Git
[Rails] What is the difference between redirect and render?
Until the use of Spring Data and JPA Part 2
[JAVA] What is the difference between interface and abstract? ?? ??
Verification of the relationship between Docker images and containers
Until the use of Spring Data and JPA Part 1
I summarized the types and basics of Java exceptions
What is the difference between skip and pending? [RSpec]
[Ruby] Class nesting, inheritance, and the basics of self
Automatically set the width and height of the UI Label
Are you using the default method of the interface properly?
What is the difference between Java EE and Jakarta EE?
[Java Silver] What are class variables instance variables and local variables?
What is the difference between the responsibilities of the domain layer and the application layer in the onion architecture [DDD]
What should I do after January 2019 regarding the Java payment issue and Java 8 end of support issue?