摘要: 异步任务 通过注解实现简单的异步任务 编写service和controller,service类加入@Async注解,启动类加入@EnableAsync注解开启异步功能 @Service public class AsyncService { @Async public void hello(){ 阅读全文
posted @ 2020-02-23 12:03 Alan*Chen 阅读(217) 评论(0) 推荐(0) 编辑
摘要: 方法一:以启动类的包路径作为顶层包路径如启动类xxxApplication.java 在 com.cicd包下那么controller所在的包就应该类似于是 com.cicd.controller 方法二:在启动上方添加@ComponentScan注解,此注解为指定扫描路径,例如:@Componen 阅读全文
posted @ 2020-02-22 09:59 Alan*Chen 阅读(1543) 评论(0) 推荐(0) 编辑
摘要: SSM框架中的依赖 <dependencies> <!-- servlet依赖的jar包 --> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>4.0 阅读全文
posted @ 2020-02-22 09:22 Alan*Chen 阅读(492) 评论(0) 推荐(0) 编辑
摘要: 查看官方文档shiro的10分钟快速搭建 http://shiro.apache.org/10-minute-tutorial.html github查看shiro源码 https://github.com/apache/shiro.git 导入依赖、新建shiro.ini和log4j.proper 阅读全文
posted @ 2020-02-21 14:49 Alan*Chen 阅读(610) 评论(0) 推荐(0) 编辑
摘要: controller中登录请求配置 @RequestMapping("/toLogin") public String toLogin(){ return "views/login"; } .新建配置类SecurityConfig,配置用户登录,实现不同用户不同访问权限 //AOP实现,不更改其他代 阅读全文
posted @ 2020-02-21 13:54 Alan*Chen 阅读(208) 评论(0) 推荐(0) 编辑
摘要: Description: Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. Reason: Failed to dete 阅读全文
posted @ 2020-02-21 12:20 Alan*Chen 阅读(723) 评论(0) 推荐(0) 编辑
摘要: 检查mapping.xml中mapper类的包名是否正确,查询语句返回参数设置是否正确 检查mapper中的方法名与mapping中的是否一致 检查application配置文件中mybatis的配置,classpath后没有/ mybatis.mapper-locations=classpath: 阅读全文
posted @ 2020-02-21 11:51 Alan*Chen 阅读(1829) 评论(0) 推荐(0) 编辑
摘要: 配置如下 spring: datasource: username: root password: 123456 url: jdbc:mysql://localhost:3306/mybatis?serverTimezone=UTC&useUnicode=true&characterEncoding 阅读全文
posted @ 2020-02-20 20:31 Alan*Chen 阅读(756) 评论(0) 推荐(0) 编辑
摘要: 对于数据访问层,无论是 SQL 还是 NOSQL,Spring Boot 底层都是采用 Spring Data 的方式进行统一处理各种数据库, Spring Data 也是 Spring 中与 Spring Boot、Spring Cloud 等齐名的知名项目。 JDBC 创建项目时引入JDBC模块 阅读全文
posted @ 2020-02-20 16:25 Alan*Chen 阅读(584) 评论(0) 推荐(0) 编辑
摘要: 自定义一个视图解析器,注入到容器,springboot就能完成自动装配 扩展MVC,指定url路径访问指定页面 SpringBoot项目中多见自定义的xxxConfiguration,主要是用于扩展配置,我们需要查看在自动配置的基础上扩展或是修改了什么功能 阅读全文
posted @ 2020-02-19 14:57 Alan*Chen 阅读(478) 评论(0) 推荐(0) 编辑