springboot
文章平均质量分 54
is me monday
这个作者很懒,什么都没留下…
展开
-
springboot静态资源访问,总是忘记,记录一下
1.在application.yml配置静态资源位置: 默认值: 静态文件位置: spring.resources.static-location: "classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/" 访问配置: spring.mv...原创 2019-12-16 15:25:15 · 161 阅读 · 0 评论 -
java之Httpclient,HtmlUnit获取网页资源
1.获取网页静态资源(没有运行js和ajax)Httpclient 引入依赖: <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <versi...原创 2019-12-09 18:27:09 · 354 阅读 · 0 评论 -
springMVC中Model和ModelMap和ModelndView和RedirectAttributes用法整理;参数接收及@RequestParam和@ModelAttribute
1,传递参数整理:Model和ModelMap和ModelndView和RedirectAttributes @RequestMapping("") public Object index(RedirectAttributes redirectAttributes) { //ModelAndView用法1//它是 HashMap<String, Objec...原创 2019-12-06 11:59:49 · 897 阅读 · 0 评论 -
springboot整合mybatis实现省市区三级查询
1.mybaties的xml文件通过mapper.selectParentAddress()查询三级数据<resultMap id="BaseResultMap" type="***.TAddress"> <id column="id" jdbcType="INTEGER" property="id"/> <result column...原创 2019-12-02 15:25:55 · 2628 阅读 · 1 评论 -
springboot手动回滚事务
1.开启事务@EnableTransactionManagement@SpringBootApplication@EnableTransactionManagement@MapperScan("")public class Application { public static void main(String[] args) { SpringApplication...原创 2019-11-06 18:48:35 · 937 阅读 · 0 评论 -
mysql数据库中mybaties逆向工程生成实体类,以及xml文件中出现重复resultmap解决办法。
1.创建springBoot项目,生成mybatis-generator.xml文件12.mybatis-generator.xml<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE generatorConfigurationPUBLIC "-//mybatis.org//DTD MyBatis Generator Conf...原创 2019-08-07 20:06:55 · 1410 阅读 · 0 评论 -
Springboot通过配置文件给实体类赋值并取值
1.定义一个实体类AppPropertites和ShiroProperties并通过注解将他们放到IOC容器中 @dada//包含get,set,hashmap,toString方法 @configuration//初始化一个当前类,并将它放入到Spring的ioc容器中 @configurationProperties(prexfix="app")//为ioc容器中的当前类填充数据 pu...原创 2019-09-05 16:38:28 · 2941 阅读 · 0 评论 -
获取springboot配置文件application.yml属性的两种方式
一:方式1,以@configurationProperties(prexfix="***")获取(适用于直接初始化一个类) 链接二:方式2.以@value("***")方式获取1.application.ymlspring: application: name: hello#三层结构:#key:spring.application.name value:hellostu...原创 2019-09-24 11:31:57 · 3366 阅读 · 0 评论