更加全面的spring注解配置可以参看spring官方文档,有所有的注解以及对应的配置文件的配置
https://docs.spring.io/spring/docs/current/spring-framework-reference/web.html
@ComponentScan(value = "com.annotation",useDefaultFilters = false,includeFilters = {@ComponentScan.Filter(type = FilterType.ANNOTATION,classes = {Controller.class,ControllerAdvice.class})})
@Configuration
public class MainConfig {
@Bean(name = "person")
public Person person(){
Person person = new Person();
person.setId(1);
person.setName("lqf");
person.setEmail("lqf@163.com");
return person;
}
}