
spring boot
文章平均质量分 76
tszxlzc
这个作者很懒,什么都没留下…
展开
-
spring boot 中DispatcherServle 的配置
1.配置类DispatcherServletConfigurationprotected static class DispatcherServletConfiguration { // 配置DispatcherServlet bean @Bean(name = DEFAULT_DISPATCHER_SERVLET_BEAN_NAME) public Dispatc...原创 2020-03-08 20:09:48 · 550 阅读 · 0 评论 -
spring boot 启动tomcat过程
从SpringApplication run方法开始public ConfigurableApplicationContext run(String... args) { 、、、 try { ApplicationArguments applicationArguments = new DefaultApplicationArguments(args); Config...原创 2020-03-08 17:44:41 · 190 阅读 · 0 评论 -
springboot mybatis 自动配置
先看自动配置类MybatisAutoConfiguration配置了几个重要的bean通过SqlSessionFactoryBean 工厂bean配置SqlSessionFactorySqlSessionTemplateMapperScannerRegistrarNotFoundConfiguration 导入AutoConfiguredMapperScannerRegistrar...原创 2020-02-16 19:15:49 · 1176 阅读 · 0 评论 -
spring mvc @ResponseBody为什么会返回json字符串
spring mvc 处理返回值要从RequestMappingHandlerAdapter 说起RequestMappingHandlerAdapter 实现了接口InitializingBeanRequestMappingHandlerAdapter bean 创建 的入口,spring boot 中是在org.springframework.web.servlet.confi...原创 2020-02-08 23:53:30 · 1020 阅读 · 0 评论 -
spring boot 数据源配置
只写一个配置类 DataSourceAutoConfiguration , 打开类看配置即可原创 2020-02-03 10:16:34 · 148 阅读 · 0 评论 -
spring boot 外部化配置源码跟踪
先展示下官方外部化配置文档点击查看官方链接配置优先级如下截图,序号越小优先级越高跟踪下源码org.springframework.boot.SpringApplication#run(java.lang.String…) 方法开始public ConfigurableApplicationContext run(String... args) { StopWatch stopW...原创 2019-12-29 18:04:42 · 157 阅读 · 0 评论 -
spring boot 自动配置pagehelper
添加maven依赖 <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-starter</artifactId> <version>1.2.3</versi...原创 2019-04-08 15:40:28 · 610 阅读 · 0 评论 -
spring boot打包方式
1. jar方式打包pom 配置<!-- 父moudle ---><parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> ...原创 2019-03-25 11:34:30 · 847 阅读 · 0 评论 -
controller 异常统一处理的四种方式,透过这四种方式看spring注解的派生性
1.当在一个Controller中任何一个方法发生异常,一定会被这个方法拦截到。由于这里controller是@RestController 注解的,等于每个方法已经添加了@ResponseBody注解,下面是@RestController 的源码@Target(ElementType.TYPE)@Retention(RetentionPolicy.RUNTIME)@Documented...原创 2019-03-07 17:32:31 · 1662 阅读 · 0 评论 -
spring boot EnableConfigurationProperties ConfigurationProperties 怎么配合使用的
先看我的demo实现第一步: 配置ConfigurationProperties属性@ConfigurationProperties(prefix = "redis.proxy")@Getter@Setterpublic class RedisProperties { /** 服务器列表*/ private List&lt;String&gt; configServerList;...原创 2019-03-06 21:36:58 · 819 阅读 · 0 评论 -
spring boot 怎么选择启动web类型
从springApplication构造方法开始@SuppressWarnings({ "unchecked", "rawtypes" }) public SpringApplication(ResourceLoader resourceLoader, Class&lt;?&gt;... primarySources) { this.resourceLoader = resourceL...原创 2019-02-27 09:04:47 · 787 阅读 · 0 评论 -
spring boot 自动配置原理:找到不同组件的配置文件、配置配置文件的属性文件
spring boot 默认会配置的配置文件 SpringBootApplication注解是程序入口@Target(ElementType.TYPE)@Retention(RetentionPolicy.RUNTIME)@Documented@Inherited@SpringBootConfiguration@EnableAutoConfiguration //Sp...原创 2019-03-05 09:15:01 · 460 阅读 · 0 评论