お世話になっております。
今回開発ツールEclipseを用いてSpringを使いDB接続の設定を行っているのですが
どうしても自分ひとりでは解決できないエラーが出てきてしまったのでどうか力を貸して
いただけないでしょうか。よろしくお願いいたします。
今回DB接続するために記述したファイルは3つになります。
エラーはJdbcTemplateConfig.xmlで起きています。
エラー箇所はエラー原因が記述してあるコメント行のすぐ上になります。
よろしくお願いいたします。
【JdbcTemplateConfig.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"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<!-- cvc-elt.1: 要素 'Beans' の宣言が見つかりません。 -->
</Beans> -----------------------------------------------------------------------<import resource="classpath:datasource-embedded.xml" /> <context:component-scan base-package="com.example"/> <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"> <property name="dataSource" ref="dataSource"/> </bean>
Bean定義【application.xml】↓↓
<?xml version="1.0" encoding="UTF-8"?><beans xmls="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchena-ibstance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<context:property-placeholder location="classpath:META-INF/jdbc.properties"/> <bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="${database.driverClassName}" /> <property name="url" value="${database.url}"/> <property name="username" value="${database.username}"/> <property name="password" value="${database.password}"/> <property name="defaultAutoCommit" value="false" /> <property name="maxTotal" value="${cp.maxTotal}"/> <property name="maxIdle" value="${cp.maIdle}"/> <property name="minIdle" value="${cp.minIdle}"/> <property name="maxWaitMillis" value="${cp.maxWaitMillis}"/> </bean> </beans>
【jdbc.properties】
database.url=jdbc:oracle:thin:@localhost:1521/SID名
database.username=【ユーザー名】
database.password=【パスワード】
database.driverClassName=oracle.jdbc.driver.OracleDriver
cp.maxTotal=96
cp.maxIdle=16
cp.minIdle=0
cp.maxWaitMillis=60000
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。