spring boot
小屁孩~~
愿你出走半生,归来任是逗逼一个·····哇哈哈哈
我欲成佛,天下无魔,我欲成魔,佛奈我何!
展开
-
spring配置多数据源bean
创建配置类package com.lenovo.cd.pf.service;import com.lenovo.cd.mf.common.datasource.DynamicDataSource;import org.springframework.beans.factory.annotation.Qualifier;import org.springframework.beans.factory.annotation.Value;import org.springframework.boot.原创 2021-08-10 15:44:35 · 574 阅读 · 0 评论 -
Spring项目启动完成后,自动执行一次指定方法
实现ApplicationListener接口,并实现 onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent)方法@Servicepublic class SearchReceive implements ApplicationListener<ContextRefreshedEvent> { @Override public void onApplicationEvent(ContextRefresh转载 2021-08-10 11:07:10 · 639 阅读 · 0 评论 -
命令启动jar包执行具体方法,调运完停止
pom文件配置<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <mainClass>com.example.weather.App</mainClass>原创 2021-07-28 15:28:18 · 73 阅读 · 0 评论 -
http请求记录post请求设置参数格式及传入参数
<dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>4.5.5</version> </dependency>http请求设定参数格式,传入必须参数//设置Ht..原创 2020-06-25 19:41:12 · 3633 阅读 · 0 评论 -
字段bean映射转换,http请求接受到的对象内值为空,jsonbject转换string成对象时为空问题
@JSONField(name = "MSGID")@JsonProperty(value = "MSGID")private String MSGID;JSONField用作string转对象时字段为空,应该字段不能正确映射,我设置的都是大写,lombok会将字段按驼峰命名转换,使字段映射失败。JsonProperty我是用作前段传值时是list中包含对象,后端接受list的对象,发现所有list中的对着字段都为空,加入这注解映射前段字段...原创 2020-06-23 18:58:40 · 455 阅读 · 1 评论 -
spring boot整合kafka记录
pom文件<dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency>原创 2020-06-19 13:03:19 · 160 阅读 · 0 评论 -
spring boot+mybatis plus启动报错,bean未注入(java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal)问题
Caused by: java.lang.ClassNotFoundException: org.w3c.dom.ElementTraversal at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native...转载 2020-06-18 11:26:18 · 581 阅读 · 0 评论 -
Spring Boot缓存注解@Cacheable、@CacheEvict、@CachePut使用
从3.1开始,Spring引入了对Cache的支持。其使用方法和原理都类似于Spring对事务管理的支持。Spring Cache是作用在方法上的,其核心思想是这样的:当我们在调用一个缓存方法时会把该方法参数和返回结果作为一个键值对存放在缓存中,等到下次利用同样的参数来调用该方法时将不再执行该方法,而是直接从缓存中获取结果进行返回。所以在使用Spring Cache的时候我们要保证我们缓存的方法对...转载 2020-03-31 14:14:44 · 233 阅读 · 0 评论 -
springboot启动时执行任务CommandLineRunner,项目启动后执行
SpringBoot中CommandLineRunner的作用> 平常开发中有可能需要实现在项目启动后执行的功能,SpringBoot提供的一种简单的实现方案就是添加一个model并实现CommandLineRunner接口,实现功能的代码放在实现的run方法中# 简单例子package org.springboot.sample.runner;import org.spring...原创 2020-03-23 15:58:46 · 1278 阅读 · 0 评论 -
SpringBoot中CommandLineRunner的作用,初始化加载
> 平常开发中有可能需要实现在项目启动后执行的功能,SpringBoot提供的一种简单的实现方案就是添加一个model并实现CommandLineRunner接口,实现功能的代码放在实现的run方法中# 简单例子``` javapackage org.springboot.sample.runner;import org.springframework.boot.Command...原创 2019-08-15 11:29:36 · 483 阅读 · 0 评论 -
javashop7(spring cloud),通过maven聚合项目,多个spring boot
javashop-b2b2c是总项目,右键选在new-----》选择maven module 下一步选择如下图next建立项目原创 2018-11-30 17:19:11 · 2014 阅读 · 5 评论 -
spring boot 与 mybatis集合创建项目
1,建立项目在pom.xml导入jar<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http原创 2018-10-24 15:38:51 · 157 阅读 · 0 评论 -
spring-boot项目与spring-boot-data-jpa数据连接结合创建项目详情
创建spring-boot项目:1,在spring.io官网下载spring-boot项目2,点击spring boot进入选择spring Initializr3,下载设置项目下载到本地后(删除不需要的,可删可不删)maven导入eclipseeclipse中的设置1:,设置application.properties# 服务器访问端口server.por...原创 2018-10-22 18:24:09 · 204 阅读 · 0 评论