일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- security.limit_extensions
- no key alg
- php
- node.js
- 앞으로 가기
- 태권브이
- 날짜계산
- 중독 게임
- php-fpm
- 리플리케이션 오류
- mongodb
- 뒤로 가기
- 재귀쿼리
- 외래키
- 쁘띠프랑스
- 훼인
- ssmtp
- 이미지주소추출
- MySQL
- xcache
- simplexml_load_filesimplexml
- openfire
- quota
- node 이미지 저장
- 태권v
- strtotime
- set foreign_key
- rsync
- 워드프레스한글팩
- 특정 패키지 업데이트 중지 / 해제
- Today
- Total
일상 기록 창고
@Configuration 과 @Bean 을 이용한 설정1 본문
기존에 디비 설정을 xml 을 통해 bean에 등록을 시켰는데.. 이 경우 xml에 고대로 노출이 되는 상황이 발생하여 자바코드로
가리기 위해 다음과 같이 설정
import javax.sql.DataSource; import org.apache.commons.dbcp.BasicDataSource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class DbConfig {
@Bean(destroyMethod="close") public DataSource dataSourceLog(){ BasicDataSource dataSourceLog = new BasicDataSource();
dataSourceLog.setDriverClassName("org.mariadb.jdbc.Driver"); dataSourceLog.setUrl("jdbc:mariadb://localhost/test"); dataSourceLog.setUsername("test"); dataSourceLog.setPassword("test");
return dataSourceLog; } } |
root-context.xml 등록된 빈이 스캔 가능하도록 처리 ( 기존 디렉토리 안에 설정했다면 굳이 필요는 없다 )
<context:component-scan base-package="경로" /> |
참고 블로그 : http://zgundam.tistory.com/26
'프로그래밍 > Spring (jsp)' 카테고리의 다른 글
org.mariadb.jdbc.internal.util.dao.QueryException: Could not read resultset: unexpected end of stream, read 0 bytes from 4 (0) | 2017.03.07 |
---|---|
@Configuration 과 @Bean 을 이용한 설정2 (0) | 2017.03.06 |
파일업로드 시 했던 일... (0) | 2017.02.14 |
JSON 파싱하기 (0) | 2017.02.14 |
JSTL Form value 처리 방법 (0) | 2017.01.23 |