![](https://img-blog.csdnimg.cn/981b220e0d274bdc9480bfeab66bd66c.jpeg?x-oss-process=image/resize,m_fixed,h_224,w_224)
springboot
文章平均质量分 51
springboot
栗栗子~
这个人很懒,什么也没写。
展开
-
XStream导出xml文件
/</</</原创 2024-07-01 11:37:37 · 172 阅读 · 0 评论 -
Could not find artifact com.sun:tools:jar:1.8 at specified path ${env.JAVA_HOME}\..\lib\tools.jar
Could not find artifact com.sun:tools:jar:1.8 at specified path ${env.JAVA_HOME}\..\lib\tools.jar。原创 2023-08-31 19:45:00 · 638 阅读 · 0 评论 -
spring security实践-全套代码
spring security,权限认证,登入原创 2023-08-14 22:45:00 · 723 阅读 · 1 评论 -
拦截器实现登录拦截和跨域问题
什么是拦截器:在AOP(Aspect-Oriented Programming)中用于在某个方法或字段被访问之前,进行拦截然后在之前或之后加入某些操作。拦截是AOP的一种实现策略为什么需要拦截器:在做身份认证或者是进行日志的记录时,我们需要通过拦截器达到我们的目的。最常用的登录拦截、或是权限校验、或是防重复提交、或是根据业务像12306去校验购票时间,总之可以去做很多的事情如何用拦截器。原创 2023-07-26 10:56:25 · 219 阅读 · 0 评论 -
springboot+mybatis出现A component required a bean of type ‘XXX‘ that could not be found错误解决
原因:mapp扫描路径写错了补充:不提交只请求数据 不要用post 用get原创 2022-01-08 20:52:13 · 1018 阅读 · 0 评论 -
java注解大全
java1、最基础注解(spring-context包下的org.springframework.stereotype)1.1、@Controller @Service @Repository @Configuration @Component1.2、 @Bean2、最基础注解(spring-web包下的org.springframework.web.bind.annotation)2.1、@ResponseBody2.2、@RequestBody2.3、@RequestMap.原创 2021-05-18 11:14:31 · 9074 阅读 · 1 评论 -
Identify and stop the process that’s listening on port 8080 or configure this application to listen
意思是端口被占用,有两个解决方案,一是结束8080端口的进程,二是换一个端口。原创 2022-07-25 15:24:31 · 512 阅读 · 0 评论 -
SpringMVC获取请求参数
1、通过ServletAPI获取将HttpServletRequest作为控制器方法的形参,此时HttpServletRequest类型的参数表示封装了当前请求的请求报文的对象@RequestMapping("/testParam")public String testParam(HttpServletRequest request){ String username = request.getParameter("username"); String password = reque原创 2022-05-03 22:45:01 · 109 阅读 · 0 评论 -
springboot常用请求处理@注解
@PathVariable、@RequestHeader、@ModelAttribute、 @RequestParam、@MatrixVariable、@CookieValue、@RequestBody@PathVariable作用:获取路径的参数比如:/user/{id}/food/{foodName},使用@PathVariable("id") Integer id, @PathVariable("foodName") String foodName能原创 2022-04-10 16:12:42 · 106 阅读 · 0 评论 -
springboot访问静态资源
1、静态资源目录只要静态资源放在类路径下: called /static (or /public or /resources or /META-INF/resources访问 : 当前项目根路径/ + 静态资源名原理: 静态映射/**。请求进来,先去找Controller看能不能处理。不能处理的所有请求又都交给静态资源处理器。静态资源也找不到则响应404页面改变默认的静态资源路径spring: mvc: static-path-pattern: /res/** resour原创 2022-04-10 14:31:09 · 392 阅读 · 0 评论 -
Springboot配置和使用lombok
1.在pom.xml文件下导入配置<dependencies> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </dependency> </dependencies>2.实体类中使原创 2022-04-09 15:25:21 · 251 阅读 · 0 评论 -
Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package.
1.在编写第一个hello springboot项目时遇到的bug。Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package.警告:你的应用上下文可能没有启动,因为你将注解添加到了默认的package上面了。下面的堆栈信息中也有一句话包括了这个意思。…This can also happen if you are @ComponentScanning a springframe原创 2022-03-25 12:00:05 · 2047 阅读 · 2 评论 -
error: can not execute. because can not find column for id from entity
报错意思:实体找不到主键,所有添加一个主键@Data@EqualsAndHashCode(callSuper = false)public class Treasure implements Serializable { private static final long serialVersionUID = 1L; /** * 收藏id */ @TableId(value = "vid", type = IdType.AUTO)//添加主键.原创 2022-01-12 21:30:01 · 1147 阅读 · 0 评论 -
Optional int parameter ‘categoryId‘ is present but cannot be translated into a null value due to be
Optional int parameter 'categoryId' is present but cannot be translated into a null value due to being declared as a primitive type.意思是categoryId 参数为空,但是你设置的类型int是非空的,最好设置成integer报错原因:参数名写错,参数为空解决办法:参数类型设置成integer...原创 2022-01-09 19:41:54 · 671 阅读 · 0 评论 -
java 同源Cors 解决跨域及填坑总结
前后端都可以解决跨域,目前项目前端使用jquey+ajax,没找到解决跨域的方法,所以使用后端解决跨域,找到了一个非常方便有效的方法,期间遇到了一点点小坑,总结于此。1.为什么会跨域出于浏览器的同源策略限制。同源策略(Sameoriginpolicy)是一种约定,它是浏览器最核心也最基本的安全功能,如果缺少了同源策略,则浏览器的正常功能可能都会受到影响。可以说Web是构建在同源策略基础之上的,浏览器只是针对同源策略的一种实现。同源策略会阻止一个域的javascript脚本和另外一个域的内容进行交.原创 2021-06-09 15:40:46 · 765 阅读 · 1 评论 -
@Param和 @PathParam
前言后端接受前端传递的参数,有常用的两种方式,@Param和 @PathParam,post请求------@Paramget请求-----@PathParam一、 @Param1.关于@Param@Param是MyBatis所提供的(org.apache.ibatis.annotations.Param),作为Dao层的注解,作用是用于传递参数,从而可以与SQL中的的字段名相对应,一般在2=<参数数<=5时使用最佳。2.使用@Param2.1 方式一/** *原创 2021-06-08 16:58:01 · 4062 阅读 · 0 评论 -
mybatis-plus+springboot的整合和使用
整合mybatis-plus1.安装Maven:<dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>3.4.3</version></dependency>2.配置Spring Boot 工程:在app..原创 2021-06-04 17:02:27 · 422 阅读 · 1 评论 -
springboot使用mybatis分页器
springboot使用mybatis分页器1.导包pom.xml<dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-starter</artifactId> <version>1.2.3</version>原创 2021-05-31 16:48:02 · 125 阅读 · 0 评论 -
基于springboot+mybatis环境下的数据库增删改查 idea版
springboot+mybatis的总体思路就是:control层调用service层的方法,service层调用mapper里面的方法,res下面的mapper的xml配置文件对应主文件里面的mapper,进行数据库查询,再一级一级往上传。原创 2021-05-31 11:32:27 · 258 阅读 · 0 评论 -
springboot整合mybatis
1.创建项目mybatis和mysql选上 ,不选也可以,后期自己在pom.xml里面配置,选上方便一些2.添加数据库CREATE TABLE `user` ( `id` int(32) NOT NULL AUTO_INCREMENT, `userName` varchar(32) NOT NULL, `passWord` varchar(50) NOT NULL, `realName` varchar(32) DEFAULT NULL, PRIMARY KEY (`id`)原创 2021-05-29 23:26:38 · 147 阅读 · 3 评论 -
Java注解:@RestController
@RestController在网上的一番搜索后,我大致总结出了几点:1.@RestController为开发提供了方便☺,在提供json接口时需要的配置操作再也不需要自己配置了。2.@RestController注解相当于@ResponseBody和@Controller的结合@Controller@ResponseBodypublic class MyController { }@RestControllerpublic class MyRestController { }.原创 2021-05-18 10:48:33 · 2338 阅读 · 0 评论