[Spring] Spring MVC Package Explorer configuration
2021.10.28 - [Developer/Spring] - maven 빌드 pom.xml 구성
I am writing down the package explorer configuration of a team project carried out in the middle of this year.
This is the part I was most curious about when I first started developing, and I hope it will be of some help to other people like me who wanted to know where and which files are located.
(There is more material on GitHub, but it wasn't easy to find a place with explanations.)
+ The project configuration varies depending on the developer's intention and framework configuration, so it is recommended to use it as a reference.
Development environment: Spring Maven, Eclipse, JAVA, JS, CSS, HTML, JSP, Oracle XE, Window 10
The description of Spring maven configuration is as follows.
java folder under main
com.example is the group default value and represents the developer or copyright group. The project name was used as the artifact name.
Because it was a team project, it was divided into subfolders based on the functions each person was responsible for, and each folder was managed by dividing them into folders called model, controller, and service. Here, / model includes VO and DAO, and / controller is a .java file that implements functions such as @RequestMapping. / service is where methods that allow connection to the DB through DAO are defined.
(The part about implementing the function will be linked in a later post.)
log4j.xml
It is automatically created when setting up Spring maven and is used to check logs. Since it is created by default, no separate settings are required. Appender determines what logs to record and how to record them. logger specifies the package area and defines the logger to be used in that area. root is the default value that defines output elements for loggers that are not set.
The log itself is used by declaring the Logger constant in the controller and declaring the class name or name of the package as a parameter. You can see the log value by running it with the corresponding constant.debug.
JRE System Library
There are libraries that allow JRE or JDK to run. It can be said to be a basic library even if it is not a Spring Framework usage environment. Please refer to OpenJDK for detailed library contents.
Maven Dependencies
As the name suggests, it contains dependencies to be applied in the maven environment.
When you want to add dependencies, right-click on the top-level project name and add the library using Maven - Add Dependency. And make sure it is set properly in the Build Path.
Alternatively, if you add the necessary dependencies in pom.xml, you can see the library being added as it is automatically built.
You can check the dependency types and preferences on the MVN REPOSITORY site.
Webapps
If you have ever created a web service, this is probably the most familiar route. It is largely composed of resources and WEB-INF.
First, resources is a space composed of subdirectories that contain materials that make up the front page necessary for running web applications, such as css, js, audio, and images.
By default, WEB-INF has spring > appServlet > servlet-contex.xml files and config/websocketContext.xml and web.xml files. Here, you can add files for setting up the view level by creating subdirectories such as tiles or views.
servlet-context.xml
This is the file referenced by DispatcherServlet. Through HandlerMapping, it searches whether there is a Controller mapped to the request and allows the request to be processed by the Controller. And again, the processing results are sent to the view stage through DidspatcherServlet.
For example, when the return value is passed as a String at the Controller stage using InternalResourceViewResolver with the following settings, a JSP file with the same file name as the return value under the set path directory is found and displayed at the view stage.
| 1 2 3 4 | beans:bean class = "org.springframework.web.servlet.view.InternalResourceViewResolver" > beans:property name = "prefix" value = "/WEB-INF/views/" / > beans:property name = "suffix" value = ".jsp" / > / beans:bean > Colored by Color Scripter | cs |
In addition, various view resolvers, such as TilesViewResolver, which is set to manage the same view level structure through tiles, can be injected as an empty object.
web.xml
This is the file that the Spring project reads first and is interpreted sequentially from the top. Also, make sure to refer to the root-context.xml file, which is an environment configuration file. In addition, web.xml can configure servlet settings, first page settings, and filter settings.
pom.xml
pom.xml adds dependencies and allows them to be applied and used in the Spring project. You can see it in the maven configuration environment. This is where most project build options are set.
2021.10.28 - [Developer/Spring] - maven build pom.xml configuration
Comments
No comments yet. Be the first!
164 posts in 테크
- 2233D Gaussian Splatting vs Unreal Engine: Two Ways to Build a 3D World — and Where Each One Ships
- 222LLMs Inside Unreal Engine: The New Skills Game Developers Need in 2026
- 220Living With Claude Fable 5: How the Most Capable Model Changes the Way You Actually Work
- 219Luma's Bet: From Video Generator to a Single Model That Thinks in Pixels
- 215The Best AI Video Models in 2026: Types, Differences, and Where This Is All Going