<small id='QNN9A'></small><noframes id='QNN9A'>

  1. <i id='QNN9A'><tr id='QNN9A'><dt id='QNN9A'><q id='QNN9A'><span id='QNN9A'><b id='QNN9A'><form id='QNN9A'><ins id='QNN9A'></ins><ul id='QNN9A'></ul><sub id='QNN9A'></sub></form><legend id='QNN9A'></legend><bdo id='QNN9A'><pre id='QNN9A'><center id='QNN9A'></center></pre></bdo></b><th id='QNN9A'></th></span></q></dt></tr></i><div id='QNN9A'><tfoot id='QNN9A'></tfoot><dl id='QNN9A'><fieldset id='QNN9A'></fieldset></dl></div>
    1. <legend id='QNN9A'><style id='QNN9A'><dir id='QNN9A'><q id='QNN9A'></q></dir></style></legend>

      <tfoot id='QNN9A'></tfoot>

        <bdo id='QNN9A'></bdo><ul id='QNN9A'></ul>

      如何使用@ComponentScan 注解扫描多个路径?

      时间:2023-07-26

      <small id='uKUqa'></small><noframes id='uKUqa'>

          <tbody id='uKUqa'></tbody>

      1. <tfoot id='uKUqa'></tfoot>
        <legend id='uKUqa'><style id='uKUqa'><dir id='uKUqa'><q id='uKUqa'></q></dir></style></legend>
        <i id='uKUqa'><tr id='uKUqa'><dt id='uKUqa'><q id='uKUqa'><span id='uKUqa'><b id='uKUqa'><form id='uKUqa'><ins id='uKUqa'></ins><ul id='uKUqa'></ul><sub id='uKUqa'></sub></form><legend id='uKUqa'></legend><bdo id='uKUqa'><pre id='uKUqa'><center id='uKUqa'></center></pre></bdo></b><th id='uKUqa'></th></span></q></dt></tr></i><div id='uKUqa'><tfoot id='uKUqa'></tfoot><dl id='uKUqa'><fieldset id='uKUqa'></fieldset></dl></div>
        • <bdo id='uKUqa'></bdo><ul id='uKUqa'></ul>

                本文介绍了如何使用@ComponentScan 注解扫描多个路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我正在使用 Spring 3.1 并使用 @Configuration@ComponentScan 属性引导应用程序.

                I'm using Spring 3.1 and bootstrapping an application using the @Configuration and @ComponentScan attributes.

                真正的开始是用

                new AnnotationConfigApplicationContext(MyRootConfigurationClass.class);
                

                这个配置类被注释了

                @Configuration
                @ComponentScan("com.my.package")
                public class MyRootConfigurationClass
                

                这很好用.但是我想更具体地了解我扫描的包,所以我尝试了.

                and this works fine. However I'd like to be more specific about the packages I scan so I tried.

                @Configuration
                @ComponentScan("com.my.package.first,com.my.package.second")
                public class MyRootConfigurationClass
                

                但是这失败了,错误提示我找不到使用 @Component 注释指定的组件.

                However this fails with errors telling me it can't find components specified using the @Component annotation.

                我所追求的正确方法是什么?

                What is the correct way to do what I'm after?

                谢谢

                推荐答案

                @ComponentScan 使用字符串数组,像这样:

                @ComponentScan uses string array, like this:

                @ComponentScan({"com.my.package.first","com.my.package.second"})
                

                当你只在一个字符串中提供多个包名时,Spring会将其解释为一个包名,因此无法找到它.

                When you provide multiple package names in only one string, Spring interprets this as one package name, and thus can't find it.

                这篇关于如何使用@ComponentScan 注解扫描多个路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:有人可以在休眠中向我解释@MapsId吗? 下一篇:javax.validation.constraints 中的注释不起作用

                相关文章

                最新文章

                <tfoot id='PUWtF'></tfoot>
                  <bdo id='PUWtF'></bdo><ul id='PUWtF'></ul>
              • <i id='PUWtF'><tr id='PUWtF'><dt id='PUWtF'><q id='PUWtF'><span id='PUWtF'><b id='PUWtF'><form id='PUWtF'><ins id='PUWtF'></ins><ul id='PUWtF'></ul><sub id='PUWtF'></sub></form><legend id='PUWtF'></legend><bdo id='PUWtF'><pre id='PUWtF'><center id='PUWtF'></center></pre></bdo></b><th id='PUWtF'></th></span></q></dt></tr></i><div id='PUWtF'><tfoot id='PUWtF'></tfoot><dl id='PUWtF'><fieldset id='PUWtF'></fieldset></dl></div>
                1. <legend id='PUWtF'><style id='PUWtF'><dir id='PUWtF'><q id='PUWtF'></q></dir></style></legend>

                    <small id='PUWtF'></small><noframes id='PUWtF'>