1. root-context.xml์ ์ญํ
root-context.xml์ ์ ํ๋ฆฌ์ผ์ด์ ์ ์ฒด์ ๊ณตํต์ ์ผ๋ก ์ฌ์ฉ๋๋ Bean์ ์ ์ํ๋ ์คํ๋ง ์ค์ ํ์ผ์ ๋๋ค. ์ฌ๊ธฐ์๋ ๋น์ฆ๋์ค ๋ก์ง์ ์ฒ๋ฆฌํ๋ ์๋น์ค(@Service), ๋ฐ์ดํฐ ์ก์ธ์ค๋ฅผ ์ฒ๋ฆฌํ๋ DAO/Repository(@Repository), ๊ณตํต์ ์ธ ์ ํธ๋ฆฌํฐ ๋ฑ์ ์ ์ํฉ๋๋ค.
- ์์:
- ์๋น์ค ๊ณ์ธต (@Service)
- ๋ฐ์ดํฐ ์ ๊ทผ ๊ณ์ธต (@Repository)
- ์์ธ ์ฒ๋ฆฌ, ๊ณตํต ์ปดํฌ๋ํธ๋ค (@Component)
root-context.xml ์์ :
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mybatis-spring="http://mybatis.org/schema/mybatis-spring"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://mybatis.org/schema/mybatis-spring http://mybatis.org/schema/mybatis-spring-1.2.xsd
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
<!-- Root Context: defines shared resources visible to all other web components -->
<bean id="hikariConfig" class="com.zaxxer.hikari.HikariConfig">
<!-- <property name="driverClassName" value="oracle.jdbc.OracleDriver"
/> <property name="jdbcUrl" value="jdbc:oracle:thin:@localhost:1521:XE" /> -->
<property name="driverClassName"
value="net.sf.log4jdbc.sql.jdbcapi.DriverSpy" />
<property name="jdbcUrl"
value="jdbc:log4jdbc:oracle:thin:@localhost:1521:XE" />
<property name="username" value="c1" />
<property name="password" value="c1" />
</bean>
<bean id="dataSource" class="com.zaxxer.hikari.HikariDataSource"
destroy-method="close">
<constructor-arg ref="hikariConfig" />
</bean>
<bean id="sqlSessionFactory"
class="org.mybatis.spring.SqlSessionFactoryBean" primary="false">
<property name="dataSource" ref="dataSource"></property>
</bean>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"></property>
</bean>
<mybatis-spring:scan base-package="com.cocoa.mapper" />
<context:component-scan base-package="com.cocoa.service"></context:component-scan>
</beans>
2. servlet-context.xml์ ์ญํ
servlet-context.xml์ Spring Web MVC ์ ํ๋ฆฌ์ผ์ด์ ์์ ์น ๊ด๋ จ ์ค์ ์ ์ฒ๋ฆฌํ๋ ํ์ผ์ ๋๋ค. ์ด ํ์ผ์ DispatcherServlet์ ์ํด ๋ก๋๋๊ณ , ์ฃผ๋ก ์น ์์ฒญ์ ์ฒ๋ฆฌํ๋ ์ปจํธ๋กค๋ฌ, ๋ทฐ ๋ฆฌ์กธ๋ฒ, ๋ฆฌ์์ค ํธ๋ค๋ง ๋ฑ์ ์ค์ ํฉ๋๋ค. @Controller๊ฐ ๋ถ์ ํด๋์ค๋ค์ ์ค์บํ๋ ๊ฒ๋ ์ด ํ์ผ์์ ์ฒ๋ฆฌํฉ๋๋ค.
- ์์:
- ์ปจํธ๋กค๋ฌ (@Controller)
- ๋ทฐ ๋ฆฌ์กธ๋ฒ: JSP ๋ทฐ๋ฅผ ์ค์ ํ๊ฑฐ๋, ํ ํ๋ฆฟ ์์ง์ ์ค์ ํ๋ ๋ถ๋ถ
- ์ ์ ๋ฆฌ์์ค ์ฒ๋ฆฌ: /resources/**์ ๊ฐ์ ์ ์ ํ์ผ์ ์ฒ๋ฆฌํ๋ ๋ถ๋ถ
- Spring MVC ํนํ ์ค์ : @Controller ๊ธฐ๋ฐ์ ์์ฒญ ์ฒ๋ฆฌ
servlet-context.xml ์์ :
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/mvc https://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">
<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
<!-- Enables the Spring MVC @Controller programming model -->
<annotation-driven />
<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
<resources mapping="/resources/**" location="/resources/" />
<!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory -->
<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>
<context:component-scan base-package="com.cocoa.controller" />
<context:component-scan base-package="com.cocoa.exception" />
</beans:beans>
3. ์ปจํธ๋กค๋ฌ์ ์์ธ ์ปดํฌ๋ํธ๋ฅผ ์ servlet-context.xml์ ๋ฃ๋๊ฐ?
@Controller์ ๊ด๋ จ๋ ์ค์ ์ ์น ์์ฒญ์ ์ฒ๋ฆฌํ๋ ๋ถ๋ถ์ด๊ธฐ ๋๋ฌธ์ servlet-context.xml์์ ์ค์ ํ๋ ๊ฒ์ด ์ ์ ํฉ๋๋ค. root-context.xml์์๋ ๋น์ฆ๋์ค ๋ก์ง์ด๋ ๋ฐ์ดํฐ ์ฒ๋ฆฌ์ ๊ด๋ จ๋ Bean๋ค์ด ์ ์๋์ง๋ง, ์ค์ HTTP ์์ฒญ์ ๋ฐ์์ ์ฒ๋ฆฌํ๋ ์ปจํธ๋กค๋ฌ๋ ์น ๊ด๋ จ ์ค์ ์ด๋ฏ๋ก servlet-context.xml์ ์ ์ํด์ผ ํฉ๋๋ค.
4. web.xml (์น ์ ํ๋ฆฌ์ผ์ด์ ๋ฐฐํฌ ์ค๋ช ์)์ ์ญํ
web.xml์ ์น ์ ํ๋ฆฌ์ผ์ด์ ์ ๋ฐฐํฌ ์ค๋ช ์(Deployment Descriptor)๋ก, ์๋ธ๋ฆฟ ์ปจํ ์ด๋(์: Tomcat)์ Spring ์น ์ ํ๋ฆฌ์ผ์ด์ ๊ฐ์ ์ค์ ๊ณผ ์ด๊ธฐํ๋ฅผ ๋ด๋นํฉ๋๋ค. ์ฃผ๋ก ์น ์ ํ๋ฆฌ์ผ์ด์ ์ ์ค์ , ์๋ธ๋ฆฟ ๋งคํ, ๋ฆฌ์ค๋ ๋ฑ๋ก ๋ฑ๊ณผ ๊ด๋ จ๋ ์ ๋ณด๋ฅผ ๋ด๊ณ ์์ต๋๋ค.
์ฃผ์ ์ญํ :
- DispatcherServlet ์ค์ : DispatcherServlet์ Spring MVC์์ ์น ์์ฒญ์ ์ฒ๋ฆฌํ๋ ์ค์ ์๋ธ๋ฆฟ์ ๋๋ค. web.xml์์ DispatcherServlet์ ์ค์ ํ์ฌ ์์ฒญ์ด DispatcherServlet์ผ๋ก ์ ๋ฌ๋๋๋ก ํฉ๋๋ค.
- ์๋ธ๋ฆฟ ๋งคํ: DispatcherServlet์ด ์ด๋ค URL ํจํด์ ์ฒ๋ฆฌํ ์ง ์ค์ ํฉ๋๋ค. ๋ณดํต / ๋๋ /app/* ๋ฑ์ผ๋ก ์ค์ ํฉ๋๋ค.
- ๋ฆฌ์ค๋ ๋ฑ๋ก: ์น ์ ํ๋ฆฌ์ผ์ด์ ์ ์์๊ณผ ์ข ๋ฃ ์ ์ํํ ์์ ์ ์ ์ํ๋ ๋ฆฌ์ค๋๋ฅผ ๋ฑ๋กํฉ๋๋ค. ์๋ฅผ ๋ค์ด, Spring์ ContextLoaderListener๋ ApplicationContext๋ฅผ ์ด๊ธฐํํ๋ ๋ฐ ์ฌ์ฉ๋ฉ๋๋ค.
- ํํฐ ์ค์ : ์น ์์ฒญ์ ๋ํ ํํฐ๋ฅผ ์ค์ ํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด, CharacterEncodingFilter๋ EncodingFilter ๋ฑ์ ์์ฒญ์ ๋ฌธ์ ์ธ์ฝ๋ฉ์ ์ค์ ํ๋ ๋ฐ ์ฌ์ฉ๋ฉ๋๋ค.
- ๊ธฐํ ์๋ธ๋ฆฟ, ํํฐ, ๋ฆฌ์ค๋ ์ค์ : ์ ํ๋ฆฌ์ผ์ด์ ์์ ํ์ํ ๋ค๋ฅธ ์๋ธ๋ฆฟ์ด๋ ํํฐ๋ค์ ์ค์ ํ ์ ์์ต๋๋ค.
web.xml ์์ :
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee https://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<!-- The definition of the Root Spring Container shared by all Servlets
and Filters -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/root-context.xml</param-value>
</context-param>
<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Processes application requests -->
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
5. pom.xml (Maven ํ๋ก์ ํธ ์ค์ ํ์ผ)์ ์ญํ
pom.xml์ Maven ๋น๋ ๋๊ตฌ์ ํ๋ก์ ํธ ๊ฐ์ฒด ๋ชจ๋ธ(POM) ํ์ผ์ ๋๋ค. ์ด ํ์ผ์ ํ๋ก์ ํธ์ ๋น๋ ์ค์ , ์ข ์์ฑ ๊ด๋ฆฌ, ํ๋ฌ๊ทธ์ธ ์ค์ ๋ฑ์ ์ ์ํฉ๋๋ค. pom.xml์ Maven์ ์ฌ์ฉํ์ฌ ํ๋ก์ ํธ๋ฅผ ๋น๋ํ๊ณ ๊ด๋ฆฌํ๋ ๋ฐ ํ์์ ์ ๋๋ค.
์ฃผ์ ์ญํ :
- ์ข ์์ฑ ๊ด๋ฆฌ: ํ๋ก์ ํธ๊ฐ ์ฌ์ฉํ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๊ทธ ๋ฒ์ ์ ์ ์ํฉ๋๋ค. ์๋ฅผ ๋ค์ด, Spring Framework, MyBatis, JPA ๋ฑ๊ณผ ๊ฐ์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๋ฒ์ ์ ๋ณด๋ฅผ ์ค์ ํ์ฌ Maven์ด ์๋์ผ๋ก ํด๋น ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ค์ ๋ค์ด๋ก๋ํ๊ณ ๊ด๋ฆฌํ๋๋ก ํฉ๋๋ค.
- ๋น๋ ์ค์ : ์ปดํ์ผ, ํจํค์ง, ํ ์คํธ ๋ฑ์ ๋น๋ ํ๋ก์ธ์ค๋ฅผ ์ ์ํฉ๋๋ค. Maven ํ๋ฌ๊ทธ์ธ์ ํตํด ์๋ํ๋ ๋น๋ ํ๋ก์ธ์ค๋ฅผ ์ค์ ํ ์ ์์ต๋๋ค.
- ํ๋กํ์ผ ์ค์ : ๋ค์ํ ํ๊ฒฝ์ ๋ง๋ ๋น๋ ์ค์ ์ ์ ์ํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด, ๊ฐ๋ฐ, ํ ์คํธ, ๋ฐฐํฌ ํ๊ฒฝ์ ๋ง๋ ์ค์ ์ ์ ๊ณตํ ์ ์์ต๋๋ค.
- ํ๋ฌ๊ทธ์ธ ์ค์ : Maven ๋น๋ ๊ณผ์ ์์ ์ฌ์ฉํ ํ๋ฌ๊ทธ์ธ(์: maven-compiler-plugin, maven-war-plugin ๋ฑ)์ ์ค์ ํ ์ ์์ต๋๋ค.
- ํ๋ก์ ํธ ๋ฉํ๋ฐ์ดํฐ ๊ด๋ฆฌ: ํ๋ก์ ํธ์ ์ด๋ฆ, ๋ฒ์ , ๋ผ์ด์ผ์ค, ๊ฐ๋ฐ์ ์ ๋ณด ๋ฑ์ ์ค์ ํ ์ ์์ต๋๋ค.
pom.xml ์์ :
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.zerock</groupId>
<artifactId>controller</artifactId>
<name>ex02</name>
<packaging>war</packaging>
<version>1.0.0-BUILD-SNAPSHOT</version>
<properties>
<java-version>11</java-version>
<org.springframework-version>5.0.7.RELEASE</org.springframework-version>
<org.aspectj-version>1.9.6</org.aspectj-version>
<org.slf4j-version>1.7.25</org.slf4j-version>
</properties>
<dependencies>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework-version}</version>
<exclusions>
<!-- Exclude Commons Logging in favor of SLF4j -->
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-test -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${org.springframework-version}</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<!-- AspectJ -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${org.aspectj-version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.aspectj/aspectjweaver -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${org.aspectj-version}</version>
<!-- <scope>runtime</scope> -->
</dependency>
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${org.slf4j-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${org.slf4j-version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${org.slf4j-version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<exclusions>
<exclusion>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</exclusion>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
</exclusions>
<!-- <scope>runtime</scope> -->
</dependency>
<!-- @Inject -->
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
<!-- Servlet -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis-spring -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.3.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.zaxxer/HikariCP -->
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>2.7.8</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.bgee.log4jdbc-log4j2/log4jdbc-log4j2-jdbc4 -->
<dependency>
<groupId>org.bgee.log4jdbc-log4j2</groupId>
<artifactId>log4jdbc-log4j2-jdbc4</artifactId>
<version>1.16</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.oracle.database.jdbc/ojdbc8 -->
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>19.3.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.14.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-xml -->
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.14.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.9</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.coobird/thumbnailator -->
<dependency>
<groupId>net.coobird</groupId>
<artifactId>thumbnailator</artifactId>
<version>0.4.8</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<additionalProjectnatures>
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
</additionalProjectnatures>
<additionalBuildcommands>
<buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
</additionalBuildcommands>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>11</source>
<target>11</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<mainClass>org.test.int1.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
6. ์ ๋ฆฌ:
- root-context.xml: ์ ํ๋ฆฌ์ผ์ด์ ์ ํต์ฌ Bean(์๋น์ค, ๋ฆฌํฌ์งํ ๋ฆฌ ๋ฑ)๊ณผ ๊ณตํต์ ์ธ ์ปดํฌ๋ํธ๋ฅผ ์ค์ ํฉ๋๋ค.
- servlet-context.xml: Spring Web MVC ๊ด๋ จ ์ค์ ์ ์ฒ๋ฆฌํ๋ ํ์ผ๋ก, @Controller์ ๊ด๋ จ๋ Bean์ ์ ์ํ๊ณ , ์น ์์ฒญ ์ฒ๋ฆฌ, ๋ทฐ ๋ฆฌ์กธ๋ฒ ๋ฑ ์น ๊ด๋ จ ์ค์ ์ ํฌํจํฉ๋๋ค.
- web.xml: ์๋ธ๋ฆฟ, ๋ฆฌ์ค๋, ํํฐ ๋ฑ์ ์น ๊ด๋ จ ์ค์ ์ ๋ด๋นํฉ๋๋ค. DispatcherServlet๊ณผ ContextLoaderListener ๋ฑ์ ์ค์ ์ด ํฌํจ๋ฉ๋๋ค.
- pom.xml: ํ๋ก์ ํธ์ ์ข ์์ฑ ๊ด๋ฆฌ์ ๋น๋ ์ค์ ์ ๋ด๋นํฉ๋๋ค. Maven์ ํตํด ํ์ํ ๋ผ์ด๋ธ๋ฌ๋ฆฌ, ๋น๋ ํ๋ฌ๊ทธ์ธ ๋ฑ์ ์ค์ ํฉ๋๋ค.
'SpringBoot' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
| [SpringBoot] DI(Dependency injection) (0) | 2025.01.12 |
|---|---|
| [SpringBoot] maven VS gradle (0) | 2025.01.12 |
| [SpringBoot] @LoginUser ์ด๋ ธํ ์ด์ (0) | 2024.10.10 |
| [SpringBoot] Spring Security์ /login ์์ฒญ ์ ์ฒ๋ฆฌ ๊ณผ์ (์ธ์ ์ ์ฅ) (5) | 2024.10.09 |
| [SpringBoot] ์๋ฒ ๋ฐฐํฌ ์ค๋จ (0) | 2024.04.30 |