No bean named BookServiceImpl available
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named ‘BookServiceImpl’ available
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'BookServiceImpl' available
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:771)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1221)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1105)
at MyTest.test(MyTest.java:11)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
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.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
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.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
Process finished with exit code -1
原因是:沒有在applicationContext.xml檔案中,註冊其他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">
<import resource="spring-mvc.xml"/>
<import resource="spring-service.xml"/>
<import resource="spring-dao.xml"/>
</beans>
相關文章
- No bean named ''XXX“ availableBeanAI
- Caused by:.NoSuchBeanDefinitionException: No bean named 'userInfoServiceImpl' availableBeanExceptionAI
- Spring:錯誤No bean named 'xxxxxxx' availableSpringBeanAI
- No Bean named 'Xxx' available 異常報錯BeanAI
- SpringBoot 學習之 No bean named ‘xxx’ availableSpring BootBeanAI
- spring中No bean named xxx available錯誤SpringBeanAI
- Maven專案報錯:No bean named 'xxxxxx' availableMavenBeanAI
- org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'aaaa' availableSpringFrameworkBeanExceptionAI
- idea maven搭建spring報錯:No bean named 'xxx' availableIdeaMavenSpringBeanAI
- 使用@Service註解出現No bean named 'xxxx' available]錯誤BeanAI
- Spring中出現:No bean named 'XXX' available問題解決SpringBeanAI
- spring-mybatis整合:NoSuchBeanDefinitionException: No bean named 'xxx.class' availableSpringMyBatisBeanExceptionAI
- 記一次idea構建springmvc報錯:No bean named 'cacheManager' availableIdeaSpringMVCBeanAI
- 程式碼改造引發的NoSuchBeanDefinitionException:no bean named 'XXXX' available問題解決方案BeanExceptionAI
- spring getBean(String) No bean named '' is definedSpringBean
- No bean named 'cacheManager' availablej 異常解決BeanAI
- No qualifying bean of type 'javax.sql.DataSource' available: expected at least 1BeanJavaSQLAIAST
- springboot註解實現非同步呼叫時no bean of type TaskExecutor and no bean named 'taskExecutor' eitherSpring Boot非同步Bean
- No bean named 'xxx' is defined錯誤,原因及解決方案Bean
- 報錯:org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'xxx'is definedSpringFrameworkBeanException
- 使用Idea構建springmvc框架,出現no bean named ‘cacheManager’ is defined 錯誤。IdeaSpringMVC框架Bean
- spring配置檔案中配置了,但找不到Bean , 啟動不報錯,執行報錯No bean namedSpringBean
- No instances available for XXXAI
- No Task Available解決方法AI
- ImportError: No module named `defusedxml`ImportErrorXML
- Bug: No module named ‘pytest‘
- ModuleNotFoundError: No module named 'pyttsx'ErrorTTS
- ImportError: No module named torchvisionImportError
- ModuleNotFoundError: No module named ‘Crypto‘ ‘Cryptodome‘Error
- CentOS 7 named配置forwardCentOSForward
- Ansible: No inventory was passed, only implicit localhost is availablelocalhostAI
- [20191211]Free SGA Memory Available.txtAI
- 【譯】gRPC-Web for .NET now availableRPCWebAI
- Basically Available(基本可用),Soft stateAI
- kafka 錯誤: larger than available brokersKafkaAI
- ModuleNotFoundError: No module named 'phkit.pinyin'Error
- CentOS 7安裝chroot NamedCentOS
- linux CentOS出現Error: xz compression not availableLinuxCentOSErrorAI