250x250
Notice
Recent Posts
Recent Comments
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
Tags
- oracle
- myBatis
- JavaScript
- maven
- Thymeleaf
- Docker
- Spring Boot
- IntelliJ
- git
- PostgreSQL
- Exception
- MySQL
- jpa
- Python
- Tomcat
- Core Java
- STS
- Open Source
- 문서
- AJAX
- spring
- ubuntu
- Eclipse
- MSSQL
- Source
- 설정
- error
- JDBC
- 오픈소스
- SpringBoot
Archives
- Today
- Total
헤르메스 LIFE
[DataSource] org.apache.commons.dbcp.BasicDataSource 사용해서 DataSource 설정 본문
Spring Framework
[DataSource] org.apache.commons.dbcp.BasicDataSource 사용해서 DataSource 설정
헤르메스의날개 2012. 5. 31. 10:07728x90
원문 : http://www.jlancer.net/board/article_view.jsp?article_no=1375&board_no=8
org.apache.commons.dbcp.BasicDataSource 사용해서 DataSource 설정
사용자 정보와 비밀번호가 xml에 설정되어 노출 되는 경우가 있어
보안상 암호화 할 필요가 있다.
이경우 org.apache.commons.dbcp.BasicDataSource 상속받아 클래스를 만들어서 사용 하면 된다.
1. Spring에서 DataSource 설정
2. 상속받아 만든 클래스
package net.jlancer.db;
import org.apache.commons.dbcp.BasicDataSource;
import com.aurasoft.crypto.PasswordEncrypt;
public class SecureBasicDataSource extends BasicDataSource {
//사용자아이디 암호화 해제 설정
public void setUsername(String username){
//암호화/해제 모듈은 각자 맞는 것을 사용 하면 됩니다.
super.setUsername(PasswordEncrypt.Decrypt(username));
}
//비밀번호 암호화 해제 설정
public void setPassword(String password) {
//암호화/해제 모듈은 각자 맞는 것을 사용 하면 됩니다.
super.setPassword(PasswordEncrypt.Decrypt(password));
}
}
728x90
'Spring Framework' 카테고리의 다른 글
| [MyBatis] mybatis config xml 예제 (1) | 2012.06.04 |
|---|---|
| [DataSource] DataSource 사용시 DB연결 끊어졌을 경우 에러방지 설정 (0) | 2012.05.31 |
| [MyBatis] ServletContextListener를 이용한 Application 시작 시 MyBatis 초기화 (0) | 2012.05.25 |
| [Log4j] Common-Logging의 문제점. (0) | 2012.05.22 |
| [Spring] ApplicationContext의 초기화 과정 (1) | 2012.05.22 |