1. pom.xml dependency 추가
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-dbcp2 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>2.9.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.6.1</version>
</dependency>
⇒ 설정 후 할 일
- 프로젝트 우클릭 - Maven - Update Project
- 프로젝트 우클릭 - Run As - Maven clean
- 프로젝트 우클릭 - Run As - Maven install
2. DB 추가
- src/main/resouces/egovframework/srping/context-datasource.xml
<bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="org.postgresql.Driver"/>
<property name="url" value="jdbc:postgresql://127.0.0.1:5432/postgres" />
<property name="username" value="이름" />
<property name="password" value="비밀번호" />
<property name="defaultAutoCommit" value="true"/>
<property name="defaultReadOnly" value="false"/>
<property name="initialSize" value="1"/>
<property name="minIdle" value="0"/>
<property name="maxTotal" value="20"/>
<property name="maxIdle" value="20"/>
<property name="maxWaitMillis" value="30000"/>
<property name="validationQuery" value="SELECT 1"/>
<property name="testOnBorrow" value="true"/>
<property name="testOnReturn" value="false"/>
<property name="testWhileIdle" value="true"/>
<property name="timeBetweenEvictionRunsMillis" value="60000" />
</bean>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource" />
</bean>
'Tools > eGovFrame' 카테고리의 다른 글
[eGovFrame] 전자정부프레임워크 설치 방법 (1) | 2024.06.13 |
---|---|
[eGovFrame] 전자정부프레임워크 (1) | 2024.06.13 |