티스토리 뷰
BackEnd 설정 순서
1. root-context.xml 설정
23번라인 마이바티스 설정 파일 중요함..
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
<?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:aop="http://www.springframework.org/schema/aop"
xmlns:c="http://www.springframework.org/schema/c"
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:lang="http://www.springframework.org/schema/lang"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:mybatis-spring="http://mybatis.org/schema/mybatis-spring"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:task="http://www.springframework.org/schema/task"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-4.3.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
http://mybatis.org/schema/mybatis-spring http://mybatis.org/schema/mybatis-spring-1.2.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.3.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
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-4.3.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.3.xsd">
<mybatis-spring:scan base-package="com.parksrazor.web.mappers"/>
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>classpath:config/database.properties</value>
</property>
</bean>
<bean class="org.apache.commons.dbcp.BasicDataSource" id="basicDataSource" >
<property name="driverClassName" value="${jdbc.driverClassName}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
</bean>
<bean class="org.mybatis.spring.SqlSessionFactoryBean" id="sqlSessionFactoryBean">
<property name="dataSource" ref="basicDataSource"/>
<property name="mapperLocations" value="classpath:com/parksrazor/web/mappers/*.xml"/>
</bean>
<bean class="org.springframework.jdbc.datasource.DataSourceTransactionManager" id="dataSourceTransactionManager">
<property name="dataSource" ref="basicDataSource"/>
</bean>
</beans>
|
cs |
2. 26번 라인에 해당하는 database.properties 파일 생성 및 DB 경로 설정
1
2
3
4
|
jdbc.driverClassName=org.mariadb.jdbc.Driver
jdbc.url: jdbc:mariadb://[AWS 경로 설정함]:3306/mariadb
jdbc.username: mariadb
jdbc.password: mariadbmariadb
|
cs |
3. PersonMapper.xml 파일을 하나 생성. 최소한의 코딩만 존재시킴.
폴더 생성시 하나씩 일일이 만들도록 해야함.
1
2
3
4
5
6
7
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.parksrazor.web.PersonMapper">
</mapper>
|
cs |
※ enum 은 @Component 하지 말것.
1
2
3
4
|
public enum Messenger {
SUCCESS,FAIL
}
|
cs |
'9. 데브옵스' 카테고리의 다른 글
[웹스톰] 리액트 타입스크립트 : ts 파일 생성 및 함수 실행 (0) | 2020.07.05 |
---|---|
[전자정부] eGovFrame3.6 버전 스프링 4.1.2에서 jackson(json) 사용 시 에러가 납니다. (0) | 2020.07.02 |
Eclipse 에서 SpringMVC 프로젝트 개발환경 설정 (0) | 2020.06.27 |
start.spring.io 를 활용하여 eclipse 에서 boot 시작하기 (0) | 2020.06.24 |
[VS코드] 터미널 명령어 모음 (0) | 2020.06.21 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- docker
- Algorithm
- KAFKA
- Oracle
- maven
- Eclipse
- JUnit
- Django
- Git
- springMVC
- Java
- JPA
- SQLAlchemy
- COLAB
- FLASK
- terms
- tensorflow
- ERD
- intellij
- React
- Mongo
- jQuery
- AWS
- mariadb
- nodejs
- database
- SpringBoot
- Python
- vscode
- Mlearn
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
글 보관함