Error creating bean with name 'userServiceImpl': Injection of autowired dependen
// 加载spring配置文件
@ContextConfiguration(locations = { "classpath:application-context.xml" })
public class TestService {
@Autowired
private UserService userService;
private static Logger logger = Logger.getLogger(TestService.class);
@Test
public void test() {
logger.info("info测试");
User user = userService.checkLogin("dsfsdf", "123");
System.out.println(user);
}
}
------------没问题 ,能查出数据--------------------
-----用tomcat 启动
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.bysj.dao.UserDao com.bysj.service.impl.UserServiceImpl.userDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDaoImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.bysj.dao.impl.UserDaoImpl.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [D:\JAVA_TOMCAT\hibernate_running\apache-tomcat-7.0.55\webapps\bysj\WEB-INF\classes\config\hibernate.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:292)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1185)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:703)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4992)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5490)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.bysj.dao.UserDao com.bysj.service.impl.UserServiceImpl.userDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDaoImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.bysj.dao.impl.UserDaoImpl.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [D:\JAVA_TOMCAT\hibernate_running\apache-tomcat-7.0.55\webapps\bysj\WEB-INF\classes\config\hibernate.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:508)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:289)
... 22 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDaoImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.bysj.dao.impl.UserDaoImpl.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [D:\JAVA_TOMCAT\hibernate_running\apache-tomcat-7.0.55\webapps\bysj\WEB-INF\classes\config\hibernate.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:292)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1185)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1017)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:960)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:858)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:480)
... 24 more
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.bysj.dao.impl.UserDaoImpl.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [D:\JAVA_TOMCAT\hibernate_running\apache-tomcat-7.0.55\webapps\bysj\WEB-INF\classes\config\hibernate.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:508)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:289)
... 35 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [D:\JAVA_TOMCAT\hibernate_running\apache-tomcat-7.0.55\webapps\bysj\WEB-INF\classes\config\hibernate.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553)(Configuration.java:3742)
---------------------配置文件
)
web.xml
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:application-context.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
application-context.xml
<context:annotation-config />
<context:component-scan base-package="com.bysj.*">
<context:exclude-filter type="annotation"
expression="org.springframework.stereotype.Controller" />
</context:component-scan>
,为什么就报错呢 , 求大神解决问题所在
相关推荐
fengmian123
fengmian123
QYR-18900-2026-2032全球与中国智能旋转导向钻井系统市场现状及未来发展趋势 Sample-shijunzhong.docx
QYR-18900-2026-2032全球与中国智能旋转导向钻井系统市场现状及未来发展趋势 Sample-shijunzhong.docx
XERJ 是一款受到社区信赖的本地 AI 搜索引擎
XERJ 是一款受到社区信赖的本地 AI 搜索引擎,能自动为任意文件夹建立索引,让编程智能体直接检索所需代码,省去逐个读取文件消耗的 token。它的主要用途是参考现有实现来写代码(reference coding):接到任务后,智能体下载与任务相关的开源仓库,建立索引,再查阅这些项目的解决方法。 在一项对照研究中,这种做法让智能体的输出 token 用量降至原来的约 1/2.7,同时保持 16/16 的任务完成率(案例研究)。用户在日常开发中报告的用量约为原来的 1/5(使用反馈)。有了可检索的参考实现,较小、较便宜的模型也可能胜过只凭记忆工作的昂贵模型,减少反复修改的次数。把下面这段提示词交给智能体即可开始
DocRes.Vulkan.WinForms.VS2022-Source-r1.1-20261016-102846-206.zip
DocRes.Vulkan.WinForms.VS2022-Source-r1.1-20261016-102846-206.zip 博客地址:https://blog.csdn.net/lw112190/article/details/168119884
电力系统连锁故障一种用于识别引发连锁故障的多重故障集合的“随机化学”算法研究(Matlab代码实现)
内容概要:本文研究了一种基于“随机化学”算法的多重故障集合识别方法,旨在准确识别电力系统中可能引发连锁故障的关键故障组合。该方法结合ADMM(交替方向乘子法)优化框架,建立了考虑连锁故障传播路径的N-k多阶段双层优化模型,并设计了高效的故障场景筛选机制,以应对大规模电网中连锁故障风险分析的高复杂性挑战。通过Matlab代码实现了算法的全流程仿真验证,结果表明该方法在识别高风险故障集方面具有较高的有效性与计算效率,为电力系统的安全评估、脆弱性分析及预防控制策略制定提供了先进的技术支撑。; 适合人群:具备电力系统分析、优化理论基础及Matlab编程能力,从事电力系统安全稳定、连锁故障防御、风险评估等相关研究的科研人员与工程技术人员。; 使用场景及目标:①应用于大规模电力系统中高风险N-k故障场景的快速识别与排序;②支撑基于N-k安全准则的电网脆弱环节分析与主动防御策略设计;③为运行调度、规划检修及应急管理提供科学的故障预案筛选工具。; 阅读建议:建议读者结合Matlab代码与论文中的模型推导,深入理解随机化学算法在双层优化框架中的实现逻辑,重点关注ADMM的分解协调机制与故障传播路径的建模方法,并通过复现仿真案例掌握其在实际电网中的应用流程与参数设置技巧。


