0

I have an msf4j application in package com.a.sample1 and I want to scan some component in com.a.sample2. Is there a way to do it in msf4j? I am using:

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

I can't put my application in com.a package to scan both sample1 and sample2 automatically, one reason is com.a.sample2 is coming from some external library.

In Spring Boot, if the components, JPA Repositories or Entities are not in sub packages of Application.java's package then we need to specify them explicitly. Is this at all possible in MSF4J?

krmanish007
  • 6,749
  • 16
  • 58
  • 100

2 Answers2

0

Though I am still waiting for the answer to scan package other than application package, there is work around. I have created an annotation, and Imported configuration class in that annotation.

So, when you add the annotation (created in sample1) in sample2, it will import configurations from sample1 and load the beans into sample2.

krmanish007
  • 6,749
  • 16
  • 58
  • 100
0

I checked MSF4J sources and found, what scans started only for package of Application class, passed as first argument into run method: https://github.com/wso2/msf4j/blob/release-2.1.0/spring/src/main/java/org/wso2/msf4j/spring/MSF4JSpringApplication.java#L165

Unfortunately it is private method and you cannot change it. From another side, "source" argument (first argument used in run method) used only for determining package autoscan - so, you can simple place any DummyClass into com.a package and run it via :

MSF4JSpringApplication
            .run(DummyClass.class, args);