Spring boot find autowired on another package

前端 未结 2 1259
猫巷女王i
猫巷女王i 2021-01-07 18:08

I\'m developing a Spring Boot application which uses some Spring Data Repository interfaces:

package test;
@SpringBootApplication
public class Application im         


        
2条回答
  •  说谎
    说谎 (楼主)
    2021-01-07 18:38

    Good to verify the scopes of classes kept in different packages by using @ComponentScan annotation in Spring boot startup custom class.

    Also add @Component in modal classes being used to allow framework accessing the classes.

    Example is kept at http://www.javarticles.com/2016/01/spring-componentscan-annotation-example.html

提交回复
热议问题