随笔分类 -  spring-boot

@EnableAutoConfiguration
摘要:1. spring文档 解释一: Enable auto-configuration of the Spring Application Context, attempting to guess and configure beans that you are likely to need. Aut 阅读全文

posted @ 2016-10-13 18:02 shuimx 阅读(479) 评论(0) 推荐(0)

@SpringBootApplication
摘要:1. spring 文档说明 Many Spring Boot developers always have their main class annotated with @Configuration, @EnableAutoConfiguration and @ComponentScan. Si 阅读全文

posted @ 2016-10-13 16:41 shuimx 阅读(530) 评论(0) 推荐(0)

@Component
摘要:1. 定义:注解类、接口、注解、枚举。 2. spring 文档说明: The @Repository annotation is a marker for any class that fulfills the role or stereotype (also known as Data Acce 阅读全文

posted @ 2016-10-13 16:34 shuimx 阅读(549) 评论(0) 推荐(0)

spring 自动扫描、注册的类是否可以定义构造函数
摘要:答案是肯定的。 方法如下: SimpleMovieLister类会被spring扫描并注册到 ApplicationContext中。 要注意:1 构造函数用@Autowired 注解 2 构造函数的参数如果需要其他对象,则参数对象也要是可以自动注入的。 阅读全文

posted @ 2016-10-13 11:32 shuimx 阅读(228) 评论(0) 推荐(0)

@Configuration 和 @Bean
摘要:1. @Bean: 1.1 定义 从定义可以看出,@Bean只能用于注解方法和注解的定义。 1.2 spring文档中对 @Bean的说明 The @Bean annotation is used to indicate that a method instantiates, configures 阅读全文

posted @ 2016-10-12 19:19 shuimx 阅读(6397) 评论(0) 推荐(0)

导航