您的位置:首页 > 编程语言 > Java开发

@SpringBootApplication注解学习

2018-05-12 16:36 796 查看

@SpringBootApplication 组合注解 (具有多个注解功能)

————@SpringBootConfiguration

————————@Documented    表明这个注解应该被 javadoc工具记录(没什么用)

————————@Configuration  表示当前类可以看作是xml配置文件,(以前我们都是xml配置现在spring推荐java配置)springboot 可以@bean

————@EnableAutoConfiguration

—————————@AutoConfigurationPackage 启动自动配置,该注解开启,使用Spring boot启动项目时,就会把找的jar包,自动配置整合.

—————————@import(xx.class)  检查jar包是否完整

————@ComponentScan   包扫描,扫描的是和标注解的该类同级目录的包


@SpringBootApplication 属性

@SpringBootApplication (exclude = {RedisAutoConfiguration.class, SolrAutoConfiguration.class})

关闭自动配置:(示例排除redis自动配置和solr自动配置)

spring Boot 提倡零xml配置,但实际情况中有些情况需要配置xml文件,如何读取呢?通过以下注解
@ImprtResource({"classpath:content.xml","classpath:a.xml"})

阅读更多
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: