上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 37 下一页
摘要: 当一个接口,有多个实现类且均已注入到spring容器中了,使用时@AutoWired是byType的,而这些实现类类型都相同,此时就需要使用@Qualifier明确指定使用那个实现类。因此,@Qualifier是byName的。 1、基本 idea提示,必须添加@Qualifier,否则红线。 最后 阅读全文
posted @ 2019-10-26 20:44 遥远2 阅读(10565) 评论(0) 推荐(4) 编辑
摘要: 在springboot中启用了@SpringBootApplication注解,就能启用spring内建注解。包含@AutoWired。 @AutoWired可标记到 属性 setter 构造器 FooFormatter 1、属性 2、setter 3、构造器 如果依赖的对象没有被注入,如 就会抛出 阅读全文
posted @ 2019-10-26 20:14 遥远2 阅读(569) 评论(0) 推荐(0) 编辑
摘要: spring cloud包含的核心特性: Distributed/versioned configuration(分布式配置) Service registration and discovery(服务注册和发现) Routing(路由) Service-to-service calls(服务调用) 阅读全文
posted @ 2019-10-26 11:32 遥远2 阅读(178) 评论(0) 推荐(0) 编辑
摘要: PropertySource顺序: 阅读全文
posted @ 2019-10-26 11:29 遥远2 阅读(200) 评论(0) 推荐(0) 编辑
摘要: 常用内建的Endpoints: 如果需要暴露Endpoints,需在application.properties或启动参数中,增加: 或者 示例: 1、在pom.xml中加入依赖 2、在application.properties中,加入 3、启动,日志发现 4、执行 输出: "java.runti 阅读全文
posted @ 2019-10-26 11:17 遥远2 阅读(956) 评论(0) 推荐(0) 编辑
摘要: Spring Boot Actuator 用于监控和管理spring应用,可通过HTTP Endpoint或JMX Bean与其交互。 阅读全文
posted @ 2019-10-26 00:19 遥远2 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 1、外部配置(externalized configuration) 2、健康检查(health checks) 3、日志 4、应用监控 阅读全文
posted @ 2019-10-25 23:59 遥远2 阅读(772) 评论(0) 推荐(0) 编辑
摘要: 基于《@SpringBootApplication 标注非引导类》例子, 1、、将App标记为@EnableAutoConfiguration,并作为App.run方法的首参。 2、WebConfiguration 3、创建自动装配类WebAutoConfiguration,并使用@Import导入 阅读全文
posted @ 2019-10-25 23:46 遥远2 阅读(241) 评论(0) 推荐(0) 编辑
摘要: 给予上个例子,将WebConfiguration类上的@SpringBootApplication换成@EnableAutoConfiguration。启动并运行http://localhost:8080/hello,发现依然可以执行。 说明: 1、尽管WebConfiguration类不再是@Co 阅读全文
posted @ 2019-10-25 23:10 遥远2 阅读(443) 评论(0) 推荐(0) 编辑
摘要: 1、引导类 2、WebConfiguration 也可以正常运行。 见《springboot-05-SpringBootApplication-03-tagnoapp》 阅读全文
posted @ 2019-10-25 22:36 遥远2 阅读(248) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 37 下一页