-2

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

careful
  • 69
  • 8
  • 1
    basePackages expects an array of **Strings**. There is no such thing as a package literal in Java. – JB Nizet Apr 29 '19 at 08:25

1 Answers1

1

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" })
  • lol, i don't know what was the bug when I did that... but now when i run the same code after restarting IntelliJ it seems to work... thanks by the way, it was i suppose some bug... – careful Apr 29 '19 at 08:43