第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

空指針異常


<?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:aop="http://www.springframework.org/schema/aop"
???????xmlns:tx="http://www.springframework.org/schema/tx"
???????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/aop
????????http://www.springframework.org/schema/aop/spring-util.xsd
????????http://www.springframework.org/schema/tx
????????http://www.springframework.org/schema/context
????????http://www.springframework.org/schema/context/spring-context.xsd">
??????<!--?引入外部屬性文件?-->
????<context:property-placeholder?location="classpath:jdbc.properties"/>


????<!--?配置c3p0的連接池?-->
????<bean?id="dataSource"?class="com.mchange.v2.c3p0.ComboPooledDataSource">
????????<property?name="driverClass"?value="${jdbc.driver}"/>
????????<property?name="jdbcUrl"?value="${jdbc.url}"/>
????????<property?name="user"?value="${jdbc.user}"/>
????????<property?name="password"?value="${jdbc.password}"/>

????</bean>

????<!--?配置業(yè)務(wù)類?-->
????<bean?id="accountService"?class="com.demo.AccountServiceInpl">
????????<property?name="accountDao"?ref="accountDao"/>
????????<context:component-scan?base-package="com.demo"/>

????</bean>
????<!--?配置dao類?-->
????<bean?id="accountDao"?class="com.demo.AccountDaoImpl">
????????<property?name="dataSource"?ref="dataSource"></property>
????</bean>

配置文件如上圖? 不知道問題在哪

正在回答

7 回答

<context:component-scan?base-package="com.demo"/>

你把這行配置放到<bean>外邊試試,不行我也看不出有什么毛病了

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

冰舞魅火 提問者

好吧 還是謝謝你了
2018-08-05 回復(fù) 有任何疑惑可以回復(fù)我~

c3p0連接池用戶名那行確定是${jdbc.user}?,應(yīng)該不是的吧

0 回復(fù) 有任何疑惑可以回復(fù)我~

咦?回復(fù)怎么這么奇怪?com.demo.AccountServiceInpl改成com.demo.AccountServiceImpl

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

冰舞魅火 提問者

(⊙o⊙)… 名字確實(shí)錯(cuò)了 但是我在bean配置的名字和實(shí)現(xiàn)類名字是一樣的 錯(cuò)誤應(yīng)該不在這吧
2018-08-05 回復(fù) 有任何疑惑可以回復(fù)我~

application配置文件 id為accountService的bean類名稱寫錯(cuò)了吧??

class="com.demo.AccountService"??應(yīng)該是com.demo.'AccountService


0 回復(fù) 有任何疑惑可以回復(fù)我~

https://img1.sycdn.imooc.com//5b668fdd0001456109570405.jpg?不知道空指針發(fā)生在哪? 代碼應(yīng)該沒問題

0 回復(fù) 有任何疑惑可以回復(fù)我~


java.lang.NullPointerException

at com.demo.Test1.Test1(Test1.java:22)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:564)

at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)

at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)

at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)

at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)

at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:73)

at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:83)

at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)

at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)

at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)

at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)

at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)

at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)

at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)

at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)

at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)

at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)

at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)

at org.junit.runners.ParentRunner.run(ParentRunner.java:363)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)

at org.junit.runner.JUnitCore.run(JUnitCore.java:137)

at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)

at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)

at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)

at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)



0 回復(fù) 有任何疑惑可以回復(fù)我~

報(bào)錯(cuò)信息發(fā)上來

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消
Spring事務(wù)管理
  • 參與學(xué)習(xí)       87319    人
  • 解答問題       204    個(gè)

事務(wù)管理是Spring重要的知識(shí),應(yīng)用事務(wù)解決數(shù)據(jù)不一致問題

進(jìn)入課程
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)