๋กœ์ผ“๐Ÿพ
article thumbnail

์Šคํ”„๋ง์—์„œ DB ์ •๋ณด๋ฅผ ๊ฐ™์€ ์ •๋ณด๋ฅผ ์ˆจ๊ธฐ๊ธฐ ์œ„ํ•ด ํ™˜๊ฒฝ๋ณ€์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค.  

๊นƒํ—™์— ํ”„๋กœ์ ํŠธ๋ฅผ ์˜ฌ๋ฆด ๋•Œ DB์ •๋ณด๊ฐ€ ์žˆ๋Š” properties ํŒŒ์ผ๋งŒ gitignore๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ปค๋ฐ‹์•ˆ๋˜๊ฒŒ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

properties ํŒŒ์ผ์˜ ๊ฒฝ๋กœ์ž…๋‹ˆ๋‹ค.

 

<bean id="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
	<property name="locations">
		<value>/WEB-INF/config/jdbc.properties</value>
	</property>
</bean>

 

PropertyPlaceholderConfigurer ํด๋ž˜์Šค์˜ ์†์„ฑ์„ ์ด์šฉํ•˜์—ฌ properties์˜ ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

jdbc.properties ํŒŒ์ผ์ž…๋‹ˆ๋‹ค.

 

""์•ˆ์— ์“ฐ์‹ค ํ•„์š” ์—†์Šต๋‹ˆ๋‹ค.

 

<bean id="dataSource"
	class="org.apache.ibatis.datasource.pooled.PooledDataSource">
		<property name="driver" value="${jdbc.driverClassName}" />
		<property name="url" value="${jdbc.url}" />
		<property name="username" value="${jdbc.username}" />
		<property name="password" value="${jdbc.password}" />
</bean>

 

์œ„์™€ ๊ฐ™์ด xml ํŒŒ์ผ์—์„œ ๋ฐ›์„์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

profile on loading

Loading...