반응형
오랜만에 스프링으로 개인 프로젝트를 하나 다시 만들어보려고 한다.
안 하다 보니 다 까먹어버리겠어...
1. Preference > General > Workspace > Text file encoding : Other [UTF-8]로 변경
한국어 출력을 올바르게 하기 위한 설정이다.
2. 톰캣 설정
쉬우니까 만드는 건 패스.......
Server Options의 Publish ... 체크하고
Server Locations의 두번째 동그라미를 체크한다.
3. 4가지 설정을 해야한다.
1) web.xml
<filter>
<filter-name>characterEncodingFilter</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>
<filter-mapping>
<filter-name>characterEncodingFilter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
</filter>
2) pom.xml 의 dependencies 아래
<!-- string escape util (html) -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.9</version>
</dependency>
<!-- ja : json 변환 .... -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.5</version>
</dependency>
<!-- ja : 메일 발송 용 라이브러리 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<!-- Java Mail API -->
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.7</version>
</dependency>
<!-- ja : 파일 업로드 처리 라이브러리 -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.3</version>
</dependency>
<!-- ja : Mybatis 관련 라이브러리 추가.. -->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.4.6</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<!-- ja : AOP 관련 -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.8</version>
</dependency>
3) rootcontext beans 아래
<!-- 메일 발송용 빈 추가 -->
<bean id="mailSender"
class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="smtp.gmail.com" />
<property name="port" value="587" />
<property name="username" value="email@gmail.com" />
<property name="password" value="cbjtwgvzegnvsmtm" />
<!-- email 요청시는 SMTP -->
<property name="javaMailProperties">
<props>
<prop key="mail.transport.protocol">smtp</prop>
<prop key="mail.smtp.auth">true</prop>
<prop key="mail.smtp.starttls.enable">true</prop>
<prop key="mail.debug">false</prop>
</props>
</property>
</bean>
<!-- Mybatis 관련 빈 등록.... -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"></property>
<property name="url" value="jdbc:oracle:thin:@localhost:1521:xe"></property>
<property name="username" value="scott"></property>
<property name="password" value="tiger"></property>
</bean>
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
</bean>
<mybatis-spring:scan base-package="com.yu.recipe.*.mapper"/>
<aop:aspectj-autoproxy></aop:aspectj-autoproxy>
<context:component-scan base-package="com.yu.recipe.*.service"></context:component-scan>
4) rootcontext namespace 추가하기
기억나는 것들 다 체크해본다....
반응형
'portfolio-projects > Learn-Ing' 카테고리의 다른 글
회원가입 / 데이터베이스 회원정보 입력 (0) | 2021.06.05 |
---|---|
[Learn-Ing] 1. 메인페이지 완성 (0) | 2021.06.02 |