如何在spring boot

时间:2016-04-14 08:27:35

标签: spring-boot

我有一个弹簧靴应用
我的申请结构是:

src
    main
        java
            org
                Application.java
                service
                        --another classes are here

Application.java

package org.baharan;
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;

    @SpringBootApplication
    public class Application {

        public static void main(String[] args) throws Throwable {
            SpringApplication.run(Application.class, args);
        }
    }   

另一个确认类文件sush as oracle config和security config在另一个应用程序(名为core)中添加到我的pom.xml中

        <dependency>
            <groupId>org.baharan.amad</groupId>
            <artifactId>core</artifactId>
            <version>1.0-releases</version>
            <type>war</type>
        </dependency>

当我构建我的应用程序时,核心应用程序的所有类和属性文件都通过overlay maven添加到我的目标中 当我执行Application.java时,spring boot找不到任何配置类不在我的应用程序中但是它们在核心中(在构建之后所有这些都添加到我的目标中)
换句话说,spring boot如何加载当前应用程序中不存在的配置类 请帮帮我。

1 个答案:

答案 0 :(得分:0)

如果它们是春季配置,您仍然可以使用@ComponentScan加载其他bean配置,例如

@ComponentScan("classpath*:com.myorg.conf")

@ComponentScan("classpath*:conf/appCtx.xml")

相关问题