上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 37 下一页
摘要: AOP即面向切面的编程,将业务逻辑代码和琐碎逻辑代码分开,达到重用或者解耦的目的 Spring中的AOP有两种实现,一种是基于jdk的,一种是基于cglib的,AopAutoConfiguration中相关代码如下: 一、基于jdk的动态代理实现 1、引入依赖 <dependency> <group 阅读全文
posted @ 2019-12-08 18:13 雷雨客 阅读(1089) 评论(0) 推荐(0)
摘要: 1、引入依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> 2、代码示例 @Repository pub 阅读全文
posted @ 2019-12-05 23:58 雷雨客 阅读(2477) 评论(0) 推荐(0)
摘要: 一、SpringBoot中默认的数据源 SpringBoot中默认的数据源是HikariDataSource 下面测试一下(pom.xml无需额外添加依赖,application.yml中简单配置如下,不配置会报错) spring: datasource: url: jdbc:mysql://loc 阅读全文
posted @ 2019-12-05 23:00 雷雨客 阅读(1158) 评论(0) 推荐(0)
摘要: 方式一、修改application.properties文件中属性 server.port=8081 server.address=127.0.0.1 server.tomcat.accesslog.enabled=true server.tomcat.accesslog.directory=d\: 阅读全文
posted @ 2019-12-05 00:40 雷雨客 阅读(10202) 评论(0) 推荐(0)
摘要: 本篇介绍一下SpringBoot中两种处理异常的方式 一、实现ErrorPageRegistrar接口,指定跳转页面 1、实现ErrorPageRegistrar接口 @Component public class CommonErrorPageRegistrar implements ErrorP 阅读全文
posted @ 2019-12-02 22:00 雷雨客 阅读(938) 评论(0) 推荐(0)
摘要: 使用步骤: 1、实现HandlerInterceptor接口,该接口有三个方法preHandle 、postHandle 、afterCompletion (1)preHandle在controller执行之前调用 (2)postHandle在controller执行之后,页面渲染之前调用 (3)a 阅读全文
posted @ 2019-12-01 17:53 雷雨客 阅读(506) 评论(0) 推荐(0)
摘要: 有两种方法实现Servlet、Filter、Listener,在启动类上添加ServletComponentScan注解,或者分别创建RegistrationBean。 一、使用在启动类上添加ServletComponentScan注解的方式 1、创建Servlet、Filter、Listener, 阅读全文
posted @ 2019-11-29 23:03 雷雨客 阅读(346) 评论(0) 推荐(0)
摘要: 一、在springboot项目中,有5个地方的静态资源可以直接访问: 1、webapp目录下 2、classpath:/static/目录下 3、classpath:/public/目录下 4、classpath:/resources/目录下 5、classpath:/META-INF/resour 阅读全文
posted @ 2019-11-25 23:17 雷雨客 阅读(2010) 评论(0) 推荐(0)
摘要: edf 阅读全文
posted @ 2019-11-24 21:09 雷雨客 阅读(731) 评论(0) 推荐(0)
摘要: 现在一般都是前后端分离项目,很少用到freemarker作为视图层,这里简单记录一下在SpringBoot中使用freemarker的过程 1、添加依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spri 阅读全文
posted @ 2019-11-24 20:33 雷雨客 阅读(603) 评论(0) 推荐(0)
上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 37 下一页