is there anyone who would know the way how to use a @ComponentScan(basePackages = {}) from class inside "test" directory to point on a packages in "main" directory.

For instance:

@Configuration
@ComponentScan(basePackages = {com.package.inside.main.directory.package1,
      com.package.inside.main.directory.package2 })
public class TestConfiguration{}

I tried this way but when i type the package name it doesn't recognize the ones outside the test directory

1 Answers

1
colter liang On Best Solutions

What do you mean? The value of "basePackages" should be a string array. So you can input any string there. Like:

@ComponentScan(basePackages = {"com.package.inside.main.directory.package1",
"com.package.inside.main.directory.package2","any package is ok" })