我使用@Order注解无效

来源:4-3 Spring Bean装配之Autowired注解说明-2

福尔摩斯易

2016-08-23 23:24

不知道为什么,我使用这个注解的时候,其排序的方式还是没有改变

写回答 关注

2回答

  • 一笑断尘
    2016-08-26 16:56:42

    信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@244038d0: startup date [Fri Aug 26 16:52:21 CST 2016]; root of context hierarchy

    org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'oneInterface' is defined

    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:641)

    at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1159)

    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:282)

    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)

    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:973)

    at com.imooc.test.base.UnitTestBase.getBean(UnitTestBase.java:42)

    at com.imooc.Testdemo.TestOneInterface.testSay(TestOneInterface.java:21)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)


  • 福尔摩斯易
    2016-08-24 10:44:21

    错误解决!是因为我导入的包围3.1.1,导入4以上的包就可以了。

Spring入门篇

为您带来IOC和AOP的基本概念及用法,为后续高级课程学习打下基础

268787 学习 · 963 问题

查看课程

相似问题