自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

TUTsmile的博客

个人学习心得笔记,希望与大家共同学习,指出我的问题

  • 博客(8)
  • 资源 (3)
  • 收藏
  • 关注

原创 websockt中无法使用service、repository

在你的websocket中,使用加入以下代码@ServerEndpoint(value = "/kungfupeng/websocket")//使用control和compoment效果相同@Componentpublic class CustomWebSocket { private static UserEntityRepository userEntityRepository; @Autowired public void setUserService (UserE

2020-05-18 22:16:01 303

原创 Spring Data Jpa:@ManyToMany 报错java.lang.StackOverflowError

在使用@ManyToMany注解的时候,在输出实体类时,出现了java.lang.StackOverflowError报错,这个是因为在实体类中,使用了@Data注解,@Data注解中的@ToString会导致java.lang.StackOverflowError此时需要将手动重写ToString方法,改写如下(不能包含ManyToMany属性):@Entity@Data@Table(name = "sys_role")public class Role { @Id @Gene

2020-05-13 17:33:19 576

原创 Spring Boot学习笔记(六)Spring Data Jpa 快速上手(五)多对多@ManyToMany 以及级联操作

阅读此文章需要有基础的jpa知识,此处不讲述entity、repository。可以查看我之前的文章Spring Data Jpa 快速上手(一)使用spring data jpa 实现增删改查1.创建表和实体类此次我们使用最常见的多对多关系,用户与角色,一个用户可以拥有多个角色,一个角色也可以被多个用户拥有。此时我们需要一个中间表保持两者的关系,因为我们通常是赋予用户某个角色,即以修改用户为主体,即虽然是多对多,但仍可视为User为主,Role为从,所以中间表在User中进行维护。此外,大家可以发

2020-05-13 17:26:32 585 1

原创 Spring Boot学习笔记(五)Spring Data Jpa 快速上手(四)多对一@ManyToOne、一对多@OneToMany,以及级联操作

建立表、实体类@Entity@Table(name = "cst_customer")@Datapublic class Customer { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "cust_id") private Integer custId; @Column(name = "cust_address") private String cus

2020-05-13 15:27:44 899

原创 Spring Boot学习笔记(四)Spring Data Jpa 快速上手(三) jpa、jpql的多条件查询与动态查询、Specification动态查询 与 PageRequest 分页

1.多条件查询多条件查询可按照我写的Spring Data Jpa 快速上手(二) jpa命名规则 与 Jpql、Sql通过命名完成多条件查询,多个条件之间用And连接例子如下:public interface UserEntityRepository extends CrudRepository<UserEntity,Integer> {// 多条件查询的命名规则// findBy + 属性名称 + “查询方式” + “多条件的连接符(and | or)” + 属性名称

2020-05-13 00:04:20 699

原创 Spring boot报错:failed to load applicationcontext

网上多为解释Spring对于此报错的处理,但由于Spring boot多为自动配置,所以无法参照旧教程解决此问题。我遇到的情况是,@Query中,命名写错导致, @Query(value = "select new map(u.id as id, u.name as name) from UserEntity u where u.email like :email") public List<Object> findByLikeEmailGetIdAndName(String

2020-05-12 15:56:16 547

原创 Spring Boot学习笔记(三)Spring Data Jpa 快速上手(二) jpa命名规则 与 Jpql、Sql

1.1 Jpa命名规则采用小驼峰命名法关键字方法命名sql where字句AndfindByNameAndPwdwhere name= ? and pwd =?OrfindByNameOrSexwhere name= ? or sex=?Is,EqualsfindById,findByIdEqualswhere id= ?BetweenfindByIdBetweenwhere id between ? and ?LessThanfindBy

2020-05-12 00:05:00 626

原创 Spring Boot学习笔记(二)Spring Data Jpa 快速上手(一)使用spring data jpa 实现增删改查,Spring boot进行单元测试

环境准备在你的application.properties进行如下设置其中datasource.sul,username和password写自己的数据库配置spring.datasource.url=jdbc:mysql://localhost:3306/db_example?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTCspri

2020-05-11 12:02:52 340

springBoot-mybatis-redis 整合解决乱码问题.rar

文章 https://blog.csdn.net/TUTsmile/article/details/108097220 所对应的工程

2020-08-19

SpringBootAndMybatis.rar

文章 使用IDEA 整合SpringBoot + mybatis详细流程 https://blog.csdn.net/TUTsmile/article/details/107681382 的工程

2020-07-30

springboot-jdbctemplete.rar

https://blog.csdn.net/TUTsmile/article/details/107655565 文章所对应的工程

2020-07-29

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除