随笔分类 -  SpringBoot

摘要:1. Spring Boot application startersspring-boot-starter-thymeleaf使用Thymeleaf视图构建MVC Web应用程序 spring-boot-starter-ws使用Spring Web服务。1.4不推荐使用,推荐使用spring-bo 阅读全文
posted @ 2019-11-07 11:52 tunan96 阅读(116) 评论(0) 推荐(0)
摘要:来源:https://m.php.cn/faq/417146.html?ivk_sa=1022894f-0-1023404i 侵删! @SpringBootApplication 包含@Configuration、@EnableAutoConfiguration、@ComponentScan 通常用 阅读全文
posted @ 2019-11-04 17:01 tunan96 阅读(110) 评论(0) 推荐(0)
摘要:占位符 阅读全文
posted @ 2019-11-04 16:56 tunan96 阅读(223) 评论(0) 推荐(0)
摘要:jdbc连接池是spring配置中的重要一环,在SpringBoot中该如何处理呢? 答案是不需要处理,我们只要找到SpringBoot提供的启动器即可: 在pom.xml中引入jdbc的启动器: SpringBoot已经自动帮我们引入了一个HikariCP连接池,因此,我们只需要指定连接池参数即可 阅读全文
posted @ 2019-10-31 22:29 tunan96 阅读(416) 评论(0) 推荐(0)
摘要:认识Thymeleaf【读音同 thyme leaf英 [taim li:f] 美 [taɪm lif]】 Thymeleaf是一个流行的模板引擎,该模板引擎采用Java语言开发; 模板引擎是一个技术名词,是跨领域跨平台的概念,在Java语言体系下有模板引擎,在C#、PHP语言体系下也有模板引擎,甚 阅读全文
posted @ 2019-10-31 22:25 tunan96 阅读(1009) 评论(0) 推荐(0)
摘要:在application.properties中配置字符编码: 阅读全文
posted @ 2019-10-31 22:06 tunan96 阅读(586) 评论(0) 推荐(0)
摘要:首先我们定义一个拦截器: 然后定义配置类,注册拦截器: 接下来运行并查看日志: 阅读全文
posted @ 2019-10-31 22:04 tunan96 阅读(144) 评论(0) 推荐(0)
摘要:pringMVC记录的log级别是debug,springboot默认是显示info以上,我们需要进行配置。 SpringBoot通过logging.level.*=debug来配置日志级别,*填写包名 阅读全文
posted @ 2019-10-31 22:04 tunan96 阅读(5836) 评论(0) 推荐(0)
摘要:集成前的准备 1、 阿里巴巴提供的dubbo集成springboot开源项目; 2、 https://github.com/alibaba 3、 我们将采用该项目提供的jar包进行集成; dubbo开发一般建议采用三个项目: 开发Dubbo服务接口项目 开发Dubbo服务提供者项目 开发Dubbo服 阅读全文
posted @ 2019-10-31 22:00 tunan96 阅读(192) 评论(0) 推荐(0)
摘要:学习中。。。长期更新,如果修改依赖后报错找不到类,maven仓库中删了对应的包即可,会自动重新下载 阅读全文
posted @ 2019-10-30 20:50 tunan96 阅读(166) 评论(0) 推荐(0)
摘要:Spring boot 集成 Redis 的步骤如下: 1、在pom.xml中配置相关的jar依赖: 2、在Springboot核心配置文件application.properties中配置redis连接信息: 3、 配置了上面的步骤,Spring boot将自动配置RedisTemplate,在需 阅读全文
posted @ 2019-10-29 23:38 tunan96 阅读(139) 评论(0) 推荐(0)
摘要:在实际开发中,我们修改某些代码逻辑功能或页面都需要重启应用,这无形中降低了开发效率; 热部署是指当我们修改代码后,服务能自动重启加载新修改的内容,这样大大提高了我们开发的效率; Spring boot热部署通过添加一个插件实现; 插件为:spring-boot-devtools,在Maven中配置如 阅读全文
posted @ 2019-10-29 23:32 tunan96 阅读(207) 评论(0) 推荐(0)
摘要:认识 RESTFull 什么是RESTFull? RESTFull 一种互联网软件架构设计的风格,但它并不是标准,它只是提出了一组客户端和服务器交互时的架构理念和设计原则,基于这种理念和原则设计的接口可以更简洁,更有层次; 任何的技术都可以实现这种理念; REST这个词,是Roy Thomas Fi 阅读全文
posted @ 2019-10-29 23:31 tunan96 阅读(397) 评论(0) 推荐(0)
摘要:Spring boot 集成 MyBatis的步骤如下: 1、在pom.xml中配置相关jar依赖 2、在Springboot的核心配置文件 application.properties 中配置MyBatis的Mapper.xml文件所在位置: # mybatis 别名扫描mybatis.type- 阅读全文
posted @ 2019-10-29 23:27 tunan96 阅读(3314) 评论(0) 推荐(0)
摘要:Spring Boot 使用事务非常简单; 1、 在入口类中使用注解 @EnableTransactionManagement 开启事务支持; 2、在访问数据库的Service实现类的方法上添加注解 @Transactional 即可; 控制器添加方法 service接口和实现类分别添加方法 访问发 阅读全文
posted @ 2019-10-29 23:27 tunan96 阅读(94) 评论(0) 推荐(0)
摘要:在Spring boot中使用jsp,按如下步骤进行: 1、在pom.xml文件中配置依赖项 2、在application.properties文件配置spring mvc的视图展示为jsp: 3、在src/main 下创建一个webapp目录,然后在该目录下新建index.jsp页面,pom.xm 阅读全文
posted @ 2019-10-29 23:24 tunan96 阅读(208) 评论(0) 推荐(0)
摘要:Spring boot下的Spring mvc 和之前的Spring mvc使用是完全一样的: @Controller 即为Spring mvc的注解,处理http请求; @RestController Spring4后新增注解; 是@Controller与@ResponseBody的组合注解; 用 阅读全文
posted @ 2019-10-29 23:22 tunan96 阅读(75) 评论(0) 推荐(0)
摘要:我们可以在Spring boot的核心配置文件中自定义配置,然后采用如下注解去读取配置的属性值; 1、@Value注解,用于逐个读取自定义的配置,比如: 在配置文件中添加 在类中使用该配置 如果出现乱码,设置编辑器 2、@ConfigurationProperties注解,将配置文件中的配置参数读取 阅读全文
posted @ 2019-10-29 23:18 tunan96 阅读(167) 评论(0) 推荐(0)
摘要:Spring boot的核心配置文件用于配置Spring boot程序,有两种格式的配置文件: 1、.properties文件 键值对的properties属性文件配置方式 2、.yml文件 yml 是一种 yaml 格式的配置文件,主要采用一定的空格、换行等格式排版进行配置; yaml 是一种直观 阅读全文
posted @ 2019-10-29 23:17 tunan96 阅读(375) 评论(0) 推荐(0)
摘要:快速开发一个Spring boot程序步骤如下: 1、创建一个Spring boot项目; 1、可以采用方式一: 使用 eclipse 的 Spring Tool Suite (STS) 插件/或者 IDEA 自带的插件创建; 2、可以采用方式二:直接使用 Maven 创建项目的方式创建; STS创 阅读全文
posted @ 2019-10-29 23:15 tunan96 阅读(202) 评论(0) 推荐(0)