티스토리 뷰

intellij에서 spring프로젝트 gradle로 생성하기 - 제5편 applicationContext.xml 생성



resources 디렉토리 우측 클릭 - New - XML Configuration File - Spring Config


applicationContext.xml 로 만들어준다.


아래와 같이 생성이 된다.


아래와 같이 코딩을 해준다.


소스코드는 아래와 같다.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

<bean id="userDao" class="UserDao">
<property name="dataSource" ref="dataSource"/>
</bean>

<bean id="dataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource" >
<property name="driverClass" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost/krkdb"/>
<property name="username" value="root" />
<property name="password" value="123456"/>
</bean>

</beans>




end.




공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/03   »
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
글 보관함