SpringBoot
爱笑的女孩运气不会太差
和大佬们一起进步
展开
-
在win环境下 启动springboot项目并指定jdk
在win环境中,指定jdk的版本原创 2021-12-17 16:56:31 · 1976 阅读 · 0 评论 -
springboot 上传图片到服务器,并把图片路径存入数据库,让前端访问图片
步骤一:准备数据库CREATE TABLE `company` ( `id` int(11) NOT NULL AUTO_INCREMENT, `company_name` varchar(255) DEFAULT NULL COMMENT '企业名称', `business_license_url` varchar(255) DEFAULT NULL COMMENT '营业执照上传url' PRIMARY KEY (`ten_id`)) ENGINE=InnoDB AUT...原创 2021-04-23 11:09:48 · 10853 阅读 · 3 评论 -
springboot 上传图片到本地
步骤一:基于前面springboot入门小demo 基于的springboot入门小demo,已包含了前面文章的知识点(比如:热部署、全局异常处理器)。步骤二:创建uploadPage.jsp上传页面 在jsp目录下新建uploadPage.jsp,需要几点: 1. method="post" 是必须的 2. enctype="multipart/form-data" 是必须的,表示提交二进制文件 3. name="file" 是必须的,和后续服务端对应 4. accep转载 2021-04-23 09:55:43 · 596 阅读 · 0 评论 -
springboot属性注入的四种方式
springboot属性注入的四种方式java配置概述一、@Autowired注入1).加入数据库依赖2.数据库配置3.读取数据库配置 的值4.验证2)使用步骤`再列举个场景: 调用第三方时,把url地址配置到文件中去,用java+注解的方式获取配置文件的值`3)、使用步骤1.写数据库配置2.配置读取数据库信息二、构造方法注入二、使用步骤1.写数据库配置2.配置读取数据库信息3打印结果:三@Bean方法形参注入二、使用步骤1.写数据库配置2.配置读取数据库信息3打印结果:二、使用步骤1.写数据库配置2.配原创 2021-04-22 17:34:52 · 2144 阅读 · 0 评论 -
导出csv格式,一个单元格内容包含“逗号”,“双引号”问题
按照如下处理步骤可实现:csv格式如果有逗号,将这个字段整体用双引号括起来;如果里面还有双引号就替换成两个双引号,这样导出来的格式就不会有问题了错误:内容是: 根据角色id更新权限,角色名称为XXX,导出显示如下要想正常显示对字符串替换,根据规则转换为 “根据角色id更新权限,角色名称为XXX” 后就能在一个单元格中正常显示解决办法:/** * 方法名称: csvHandlerStr</br> * 方法描述: 处理包含逗号,或者双引号的字段</b..转载 2020-06-17 11:07:40 · 6209 阅读 · 1 评论 -
springboot启动报错The APR based Apache Tomcat Native library which allows optimal performance in product
2020-04-02 18:25:31.573 ERROR 772 --- [ost-startStop-1] o.s.b.web.embedded.tomcat.TomcatStarter : Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyExc...原创 2020-04-02 18:30:40 · 830 阅读 · 1 评论 -
springboot启动失败哪位可以帮忙解决一下
"C:\Program Files\Java\jdk1.8.0_202\bin\java.exe" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView...原创 2020-04-02 17:05:06 · 1338 阅读 · 7 评论 -
springboot报错Error creating bean with name 'dataSource' defined in class path resource
报错信息如下:2020-04-02 15:25:15.549 WARN 4360 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.spri...原创 2020-04-02 15:32:42 · 20437 阅读 · 3 评论 -
使用swagger自动生成在线文档
1.加入依赖<!--集成swagger--> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <v...原创 2020-03-26 15:16:36 · 1197 阅读 · 2 评论 -
springboot集成thymeleaf
1.添加thymeleaf依赖<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId></dependency>2.编写一个controller类...原创 2019-07-12 11:57:45 · 132 阅读 · 0 评论 -
springboot加载配置文件位置
加载顺序从高到低,高优先级的覆盖低优先级的配置文件–file:./config/ –file:./ –classpath:/config/ –classpath:/没有配置的,形成互补配置原创 2019-07-04 16:54:03 · 239 阅读 · 0 评论 -
springboot多环境配置Profile
配置文件名可以是 application-{profifile}.properties/yml 默认读取application.properties配置文件想激活其中的配置文件使用:1.在application.properties文件中激活指定的配置文件spring.profiles.active=proyml支持多文档块的方式虚拟机参数激活...原创 2019-07-01 17:06:51 · 277 阅读 · 0 评论 -
springboot特点
1.微框架,与spring4一起诞生,如@RestController2.springboot可以创建独立运行的应用而不依赖于容器3. 不需要打包成war包,可以放入Tomcat中直接运行4.提供maven极简配置,缺点是会引入很多你不需要的包5.根据项目来依赖,从而配置spring,需要什么配置什么,做到了可控6.提供了监控、应用的健康等功能7.简化配置,不需要配置过多的xml,只需...原创 2019-01-09 15:32:29 · 1694 阅读 · 0 评论 -
springboot加载配置文件位置
加载文件的先后顺序使用命令在项目目录下启动:java -jar xxx.jar --spring.config.location=F:\xxx.properties原创 2018-12-07 10:55:25 · 240 阅读 · 0 评论 -
springboot使用devtools进行热部署
1.在pom.xml文件中添加以下依赖,然后在idea中选中项目右击maven---》ReImport更新依赖<dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boo...原创 2018-12-07 10:29:41 · 452 阅读 · 0 评论 -
springboot报错Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException:
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.example.DBConnector' available: expected at least 1 bean which qualifies as autowire candida原创 2017-09-18 23:27:30 · 7129 阅读 · 0 评论 -
springboot三种启动方式
请看链接http://note.youdao.com/noteshare?id=ab537b969d99964956775a6ec7fe2505&sub=238B44DE22974BC2859CBDDB4769ED1E原创 2017-09-18 23:30:04 · 491 阅读 · 0 评论 -
使用IDEA创建springboot项目时,出现错误Cannot download 'https://start.spring.io': connect timed out
第一步创建项目:create New Project第二步:然后错误如图: 错误的意思为: 初始化失败”https://start.spring.io” 请检查URL、网络和代理设置。 错误消息: 无法下载“https://start.spring.io”:连接超时解决办法 将url地址改为http://start.spring.io即可成功解决问题...原创 2018-03-19 14:47:36 · 49280 阅读 · 37 评论 -
springboot项目更新依赖、项目
更新依赖包更新项目原创 2018-09-08 17:19:17 · 2437 阅读 · 0 评论 -
springboot中THYMELEAF 配置
# THYMELEAF (ThymeleafAutoConfiguration)spring.thymeleaf.cache=true # Whether to enable template caching.spring.thymeleaf.check-template=true # Whether to check that the template exists before rend...原创 2018-09-13 16:49:57 · 956 阅读 · 0 评论 -
springboot2.0.5 freemarker配置文件
# FREEMARKER (FreeMarkerProperties)# Whether HttpServletRequest attributes are allowed to override (hide) controller generated model attributes of the same name.spring.freemarker.allow-request-over...原创 2018-09-14 14:02:17 · 984 阅读 · 0 评论 -
springboot2.0.5 中DataSource配置文件
# DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)# Whether to stop if an error occurs while initializing the database.spring.datasource.continue-on-error=false # Data (DML) scr...原创 2018-09-14 15:50:59 · 2608 阅读 · 1 评论 -
一 springboot简介
一 Springboot官网介绍: Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can "just run".We take an opinionated view of the Spring platform and th...原创 2018-11-30 09:57:18 · 281 阅读 · 2 评论 -
二 springboot的第一个小程序Hello word
环境: Spring Boot 2.1.0.RELEASE 需要Java 8 or 9 and Spring Framework 5.1.2.RELEASE 以上. Maven 3.3+ Gradle 4.4+ Tomcat 9.0 Servlet 4.0 Jetty9.4 Servlet 3.1 Undert...原创 2018-11-30 10:01:36 · 223 阅读 · 0 评论 -
springboot是如何管理应用中所有的依赖版本?
1. 作为一个springboot项目必须要加上以下依赖,这是Spring Boot的父级依赖,这样当前的项目就是Spring Boot项目了。spring-boot-starter-parent 是一个特殊的starter,它用来提供相关的Maven默认依赖。使用它之后,常用的包依赖可以省去version标签。 <parent> <groupId>org...原创 2018-11-30 10:17:52 · 7384 阅读 · 0 评论 -
部署springboot项目
在pom.xml文件添加依赖<!--可将程序打包成一个可执行的jar--><build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>sp原创 2018-12-06 17:12:06 · 362 阅读 · 0 评论 -
springboot
springboot:1). ctrl-c:关闭程序2).很多开发者采用"共享的"jars。一个共享的jar简单地将来自所有jars的类打包进;一个单独的“超级jar”Spring Boot采取一个不同的途径,,并允许你真正的内嵌jars。org.springframework.bootspring-boot-maven-plugin原创 2017-09-14 11:52:32 · 204 阅读 · 0 评论