@SpringBootApplication(scanBasePackages={"com.package1"})
public class SpringbootIn10StepsApplication {
public static void main(String[] args) {
ApplicationContext applicationContext =
SpringApplication.run(SpringbootIn10StepsApplication.class, args);
}
}
与
application.properties scan.packages = com.package1
@SpringBootApplication(scanBasePackages="${scan.packages}")
public class SpringbootIn10StepsApplication {
public static void main(String[] args) {
ApplicationContext applicationContext =
SpringApplication.run(SpringbootIn10StepsApplication.class, args);
}
}
我提到了如何使用application.properties文件中可用的注释和属性扫描软件包。 我需要知道确切的区别是哪一个先加载? 我可以使用scan.packages属性添加多个软件包吗?