springboot
大叔手残勿喷
一个不起眼的程序猿,新生代的农民工
展开
-
springboot配置index
springboot配置index路径如下:路径这样放,默认就显示index页面原创 2021-09-28 19:51:39 · 1210 阅读 · 0 评论 -
new HashMap<String, Object>();
HashMap可以认为一对数据的集合,一对数据的集合Map<String, String> map=new HashMap<String,String>()把value加给keymap.put(key,value);如: map.put("S301","张三");map.put("S301","李四");只保留map.put("S301","李四");//String一个key只能有一个value获取当前keyProductlist.get(key); 通原创 2021-08-18 10:51:23 · 3900 阅读 · 0 评论 -
js,html条码生成
下载地址案例 源码展示:原创 2021-06-12 16:00:42 · 128 阅读 · 0 评论 -
springboot:记录jdbc
Demo01import java.sql.Connection;import java.sql.ResultSet;import java.sql.Statement;public class Demo01 { public static void main(String[] args) { //获取连接 try (Connection conn = DBUtils.getConn();) { //创建SQL执行对象 Statement stat = conn.create原创 2021-03-03 10:16:03 · 83 阅读 · 0 评论 -
SpringBoot入门_搭建及配置环境(eclipse || Spring ToolS)
r如果没有开发软件那就可以点击链接下载Springboot开发工具:1.eclipse配置springboot环境help—Eclipsemarketplace——在find中查找springboot然后安装。2.配置jdkwindow–perferences–Java —installedJRE—add(搜索programfiles–Java–jdk1.8)3.配置mavenwindow–perferences–maven–installations—add(添加下载好的maven)部署完原创 2020-09-24 11:49:47 · 245 阅读 · 0 评论 -
springboot----静态页面templates文件访问
templates里css和js静态怎么访问?一般资源存放目录如下:resources 可以存放资源文件static 静态资源templates 页面,templates只能通过 controller来访问因为初步 我在resources目录下 建了两个文件templates 和static ;和主目录下建了个controller包及indexcontroller.javaindexcontroller如下:@Controller // 可以被视图解析器解析public class ind原创 2020-09-25 11:50:05 · 1239 阅读 · 0 评论 -
springboot---【jdbc】数据库连接池
环境需求:eclipse(springboot,Tomcat,maven)和MySQL数据库1.首先配置pom文件和application.yml文件application.ymlserver: port: 8080spring: datasource: url: jdbc:mysql://localhost:3306/test_1?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useUnicode=true原创 2020-10-06 19:42:13 · 839 阅读 · 0 评论 -
MissingServletRequestPartException: Required request part ‘file‘ is not present]
报错:2020-10-20 19:09:32.298 WARN 5696 --- [nio-8080-exec-6] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.multipart.support.MissingServletRequestPartException: Required request part 'file' is not present]2020-10-20 19:19:37原创 2020-10-20 19:26:11 · 1196 阅读 · 0 评论 -
Error creating bean with name ‘userController‘: Unsatisfied dependency expre
报错:Error creating bean with name ‘userController’: Unsatisfied dependency expre。。。。原因:avatarmaxsize的格式原写是int。修改string后再下面的异常方法里添加:Integer.parseInt()原创 2020-10-20 10:12:39 · 11277 阅读 · 1 评论 -
Mybatis报错: Invalid bound statement (not found)...
报错内容如下Rerun updateInfoByUid()cn.cyjt.shoot.mapper.UserMapperTestsupdateInfoByUid(cn.cyjt.shoot.mapper.UserMapperTests)org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): cn.cyjt.shoot.mapper.UserMapper.updateInfoByUid at原创 2020-10-19 11:54:00 · 126 阅读 · 0 评论 -
服务器向客户端不响应为null的属性(为了便于查询JSON数据)spring.jackson.default-property-inclusion=NON_NULL
#为了便于查询JSON数据,隐藏没有值的属性,减少流量的消耗,服务器不应该向客户端响应为null的属性!可以在属性或类之前添加@JsonInclude(value=Include.NON_NULL),也可以在application.properties中添加全局的配置:spring.jackson.default-property-inclusion=NON_NULL...原创 2020-10-17 13:18:37 · 3193 阅读 · 0 评论 -
问题: springboot返回登录失败
springboot怎么返回登录失败?UserController方法:BaseControllermessage是什么?JsonResultUserController这是原来的UserController里的login:@RequestMapping("login") public class UserController extends BaseController { @Autowired private IUserService userService; @RequestMap原创 2020-10-17 12:54:05 · 1377 阅读 · 0 评论 -
public ServiceException() { super(); } public ServiceException(String message, Throwable cause,
凡操作失败都应该抛出某种异常,为了便于管理自定义的异常,应该先创建这些异常的基类,在创建异常要生成【无参构造】方法,如下一样:快捷键是:代码区域->右键->source->GenerateConstructors from Supperclass…无参数构造方法alt+shift+s+c//ServiceException.凡操作失败都应该抛出某种异常,为了便于管理自定义的异常,应该先创建这些异常的基类public class ServiceException extends Ru原创 2020-10-16 16:24:17 · 594 阅读 · 0 评论 -
springboot设置UTF-8
UTF-8application.propertiespom.xmlapplication.properties#解决返回乱码问题#spring.http.encoding.charset=UTF-8#spring.http.encoding.force=true#spring.http.encoding.enabled=trueserver.servlet.encoding.charset=UTF-8server.servlet.encoding.force=trueserver.serv原创 2020-10-16 12:12:04 · 4372 阅读 · 0 评论 -
springboot入门(项目)
springboot 第一天原创 2020-10-15 17:04:11 · 378 阅读 · 0 评论 -
springboot页面乱码问题
springboot静态页面明明utf8但执行时还是出现中文乱码问题解决方法如下:#application.yml文件下加一下内容:#解决返回乱码问题spring: http: encoding: charset: utf-8 enabled: true force: true#application.properties文件下加一下内容:#解决返回乱码问题#spring.http.encoding.charset=UTF-8#spring.原创 2020-10-13 19:20:08 · 550 阅读 · 0 评论 -
Error creating bean with name ‘cn.cyjt.shoot.service.UserServiceTests‘: Unsatisfied dependency expre
springboot报错:创建名为“”的bean时出错”cn.cyjt.shoot.service.UserServiceTests’:通过字段“service”表示的不满足的依赖关系;嵌套异常是org.springframework.beans.factory.NoSuchBeanDefinitionException:没有限定类型为’cn.cyjt.shoot.service.IUSERVICE’available:至少需要1个符合autowire候选的bean。依赖项批注:{@org.springf原创 2020-10-13 17:23:37 · 397 阅读 · 0 评论 -
解决Action: Consider the following: If you want an embedded database (H2, HSQL or Derby), ple..
问题springboot异常Action: Consider the following: If you want an embedded database (H2, HSQL or Derby), please put i…**解释:**在pom中引入了mybatis-spring-boot-starter ,Spring boot默认会加载org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration类,DataSo原创 2020-10-08 19:10:08 · 7016 阅读 · 0 评论 -
springboot报错---@RunWith(SpringRunner.class)
@RunWith(SpringRunner.class)因为缺乏pom文件里Junit依赖导致。解决方法:在pom.xml里添加以下依赖<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </原创 2020-10-08 13:14:01 · 2553 阅读 · 0 评论 -
springboot报错---No identifier specified for entity: com.example.demo.entity.User
No identifier specified for entity: com.example.demo.entity.User报错内容如下:因为JPA缺少@id导致的解决方法:添加如图内容:import javax.persistence.Id;@id原创 2020-10-06 20:00:30 · 2137 阅读 · 0 评论 -
eclipse环境lsp4e --- org.eclipse.lsp4e
org.eclipse.lsp4e报错!lsp4e是一个插件解决方法:点击【help】-【install new software】work with中输入:http://download.eclipse.org/lsp4e/releases/latest/原创 2020-10-06 13:23:56 · 2076 阅读 · 0 评论 -
springboot连接SQL数据库配置application
application.properties连接SQL数据库原创 2020-10-06 12:14:49 · 1078 阅读 · 2 评论