合集-Java中使用到的模板

摘要:2023-08-30 driverClassName=com.mysql.cj.jdbc.Driver url=jdbc:mysql://localhost:3306/xxx?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTim 阅读全文
posted @ 2023-08-30 13:46 努力是一种常态 阅读(200) 评论(0) 推荐(0)
摘要:2023-08-30 import java.util.Scanner; public class Utility { //静态属性。。。 private static Scanner scanner = new Scanner(System.in); /** * 功能:读取键盘输入的一个菜单选项, 阅读全文
posted @ 2023-08-30 20:48 努力是一种常态 阅读(104) 评论(0) 推荐(0)
摘要:2023-09-01 jdbc:mysql://localhost:3306/xxxx?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone = GMT&rewriteBatchedStatements=true 阅读全文
posted @ 2023-09-01 18:54 努力是一种常态 阅读(669) 评论(1) 推荐(0)
摘要:2023-09-02 依赖的jar包 <!-- log4j --><dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.17</version></dependency> 配置文件 <?xm 阅读全文
posted @ 2023-09-02 10:49 努力是一种常态 阅读(105) 评论(0) 推荐(0)
摘要:2023-09-02 UserMapper.xml模板 方式一: <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis. 阅读全文
posted @ 2023-09-02 10:56 努力是一种常态 阅读(501) 评论(0) 推荐(0)
摘要:2023-09-02 <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis 阅读全文
posted @ 2023-09-02 10:57 努力是一种常态 阅读(194) 评论(2) 推荐(0)
摘要:2023-09-02 <?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapp 阅读全文
posted @ 2023-09-02 12:14 努力是一种常态 阅读(61) 评论(0) 推荐(0)
摘要:2023-09-03 <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.1.0</version> <scope>provided</scope> < 阅读全文
posted @ 2023-09-03 11:30 努力是一种常态 阅读(86) 评论(0) 推荐(0)
摘要:2023-09-03 package com.hh.RequestAndResponse; /** * @author hh * @version 1.0 * @DATE 2023-09-03 12:51:44 */ import javax.servlet.ServletException; im 阅读全文
posted @ 2023-09-03 13:15 努力是一种常态 阅读(73) 评论(0) 推荐(0)
摘要:2023-09-03 方式一 package com.hh.util; import org.apache.ibatis.io.Resources; import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibati 阅读全文
posted @ 2023-09-03 15:19 努力是一种常态 阅读(42) 评论(0) 推荐(0)
摘要:2023-09-04 package com.hh.util; import javax.imageio.ImageIO; import java.awt.*; import java.awt.geom.AffineTransform; import java.awt.image.BufferedI 阅读全文
posted @ 2023-09-04 13:24 努力是一种常态 阅读(188) 评论(0) 推荐(0)
摘要:2023-09-07 applicationContext.xml 步骤: 需要设置命名空间 设置jdbc.properties的占位符 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.o 阅读全文
posted @ 2023-09-07 10:23 努力是一种常态 阅读(163) 评论(0) 推荐(0)
摘要:2023-09-07 applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http:// 阅读全文
posted @ 2023-09-07 11:54 努力是一种常态 阅读(48) 评论(0) 推荐(0)
摘要:2023-09-07 package com.hh.config; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configura 阅读全文
posted @ 2023-09-07 12:18 努力是一种常态 阅读(33) 评论(0) 推荐(0)
摘要:2023-09-07 jdbc.properties 注意里面的url中此时里面书写的是&而不是转移之后的,以及要注意数据库的名称是否存在 jdbc.driverClassName=com.mysql.cj.jdbc.Driver jdbc.url=jdbc:mysql://localhost:33 阅读全文
posted @ 2023-09-07 14:59 努力是一种常态 阅读(126) 评论(0) 推荐(0)
摘要:2023-09-07 注意:spring整合junit中的依赖要和spring-context的依赖版本相一致 <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.13.2</version> 阅读全文
posted @ 2023-09-07 15:11 努力是一种常态 阅读(66) 评论(0) 推荐(0)
摘要:2023-09-07 <?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-insta 阅读全文
posted @ 2023-09-07 17:09 努力是一种常态 阅读(351) 评论(0) 推荐(0)
摘要:2023-09-08 <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.15.2</version> </dependency 阅读全文
posted @ 2023-09-08 11:20 努力是一种常态 阅读(50) 评论(0) 推荐(0)
摘要:2023-09-09 注意,注意,一定要注意,mybatis的jar包与mybatis-spring的jar包的版本,一定要看这两个jar包的版本下面是与java8匹配的版本 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi=" 阅读全文
posted @ 2023-09-09 00:32 努力是一种常态 阅读(49) 评论(0) 推荐(0)
摘要:2023-09-09 BusinessException package com.hh.exception; /** * @author hh * @version 1.0 * @DATE 2023-09-09 9:39:49 */ public class BusinessException ex 阅读全文
posted @ 2023-09-09 10:09 努力是一种常态 阅读(47) 评论(0) 推荐(0)
摘要:2023-09-10 maven中配置多环境的写法 <!-- 多环境配置--> <profiles> <!-- 开发环境--> <profile> <id>env_dep</id> <properties> <jdbc.url>jdbc:mysql://127.0.0.1:3306/db01?use 阅读全文
posted @ 2023-09-10 12:04 努力是一种常态 阅读(75) 评论(0) 推荐(0)
摘要:2023-09-10 spring: profiles: active: dev spring: profiles: dev server: port: 8080 spring: profiles: pro server: port: 8081 spring: profiles: test serv 阅读全文
posted @ 2023-09-10 15:25 努力是一种常态 阅读(185) 评论(2) 推荐(0)
摘要:2023-09-10 spring: datasource: type: com.alibaba.druid.pool.DruidDataSource driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://localhost:33 阅读全文
posted @ 2023-09-10 17:26 努力是一种常态 阅读(284) 评论(0) 推荐(0)
摘要:2023-09-10 mybatis-plus中添加的依赖 <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>3.4.0</version> 阅读全文
posted @ 2023-09-10 18:19 努力是一种常态 阅读(288) 评论(0) 推荐(0)
摘要:2023-09-10 目录结构 logback.xml <?xml version="1.0" encoding="UTF-8"?> <configuration> </configuration> application.yml spring: datasource: driver-class-n 阅读全文
posted @ 2023-09-10 18:46 努力是一种常态 阅读(368) 评论(0) 推荐(0)
摘要:2023-09-10 @Data @TableName("tbl_phone") public class Phone { @TableField(select = false) private Integer id; private String type; private String name 阅读全文
posted @ 2023-09-10 21:14 努力是一种常态 阅读(578) 评论(0) 推荐(0)
摘要:2023-09-10 version字段表示乐观锁 在表结构中添加一个字段表示乐观锁 package com.hh.domain; import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatispl 阅读全文
posted @ 2023-09-10 22:04 努力是一种常态 阅读(69) 评论(0) 推荐(0)
摘要:2023-09-11 <!--代码生成器--> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-generator</artifactId> <version>3.3.1</version> </depend 阅读全文
posted @ 2023-09-11 09:08 努力是一种常态 阅读(127) 评论(0) 推荐(0)
摘要:2023-09-11 1、模糊查询 UserMapper List<User> getUserByLike(String mohu); UserMapper.xml <select id="getUserByLike" resultType="com.hh.pojo.User"> select * 阅读全文
posted @ 2023-09-11 19:35 努力是一种常态 阅读(101) 评论(0) 推荐(0)
摘要:2023-09-11 UserMapper void insertUser(User user); UserMapper.xml <insert id="insertUser" useGeneratedKeys="true" keyProperty="id"> insert into t_user 阅读全文
posted @ 2023-09-11 21:03 努力是一种常态 阅读(26) 评论(0) 推荐(0)
摘要:2023-09-12 仓库 StoreHouseMapper /** * 分步查询 * 首先通过仓库的id查询出仓库 */ StoreHouse getSHAndGoodsByStepOne(@Param("id")Integer id); StoreHouseMapper.xml <resultM 阅读全文
posted @ 2023-09-12 08:52 努力是一种常态 阅读(70) 评论(0) 推荐(0)
摘要:2023-09-12 StoreHouseMapper package com.hh.mapper; import com.hh.pojo.StoreHouse; import java.util.List; /** * @author hh * @version 1.0 * @DATE 2023- 阅读全文
posted @ 2023-09-12 14:31 努力是一种常态 阅读(47) 评论(0) 推荐(0)
摘要:2023-09-12 StoreHouseMapper /** * 批量添加 */ void insertMoreSH(@Param("storeHouses") List<StoreHouse> storeHouses); /** * 批量删除方式一 */ void deleteMoreSH(@P 阅读全文
posted @ 2023-09-12 15:13 努力是一种常态 阅读(105) 评论(0) 推荐(0)
摘要:2023-09-12 导入的依赖 <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper</artifactId> <version>5.3.2</version> </dependency> myba 阅读全文
posted @ 2023-09-12 17:05 努力是一种常态 阅读(76) 评论(0) 推荐(0)
摘要:2023-09-14 spring-jdbc.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3. 阅读全文
posted @ 2023-09-14 15:23 努力是一种常态 阅读(127) 评论(0) 推荐(0)
摘要:2023-09-14 web.xml <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" > <web- 阅读全文
posted @ 2023-09-14 18:40 努力是一种常态 阅读(186) 评论(0) 推荐(0)
摘要:2023-09-14 web.xml <!--设置编码格式,解决字符乱码--> <filter> <filter-name>CharacterEncodingFilter</filter-name> <filter-class>org.springframework.web.filter.Chara 阅读全文
posted @ 2023-09-14 21:22 努力是一种常态 阅读(63) 评论(0) 推荐(0)
摘要:2023-09-15 web.xml <!--请求方式过滤器--> <filter> <filter-name>HiddenHttpMethodFilter</filter-name> <filter-class>org.springframework.web.filter.HiddenHttpMe 阅读全文
posted @ 2023-09-15 10:04 努力是一种常态 阅读(55) 评论(0) 推荐(0)
摘要:2023-09-15 <!--设置默认的servlet处理静态资源--> <mvc:default-servlet-handler/> <!--开启视图注解驱动器--> <mvc:annotation-driven /> <mvc:view-controller path="/" view-name 阅读全文
posted @ 2023-09-15 10:46 努力是一种常态 阅读(50) 评论(0) 推荐(0)
摘要:2023-09-15 web.xml <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" > <web- 阅读全文
posted @ 2023-09-15 17:05 努力是一种常态 阅读(550) 评论(0) 推荐(0)
摘要:2023-09-16 springmvc.xml <!--配置拦截器--> <mvc:interceptors> <mvc:interceptor> <!--配置需要拦截的请求的请求路径--> <mvc:mapping path="/**"/> <!--配置需要排除拦截的请求的请求路径--> <mv 阅读全文
posted @ 2023-09-16 11:06 努力是一种常态 阅读(391) 评论(0) 推荐(0)
摘要:2023-09-16 方式一 springmvc.xml <!--配置异常处理器--> <bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"> <property name="exce 阅读全文
posted @ 2023-09-16 11:37 努力是一种常态 阅读(265) 评论(0) 推荐(0)
摘要:2023-09-16 导入的依赖 <dependencies> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.4</version> 阅读全文
posted @ 2023-09-16 12:39 努力是一种常态 阅读(324) 评论(0) 推荐(0)
摘要:2023-09-17 加载图片的静态资源可以放在resources下面的四个文件夹中,命名必须为 (1)“META-INF”下的“resources” 或者(2)public 或者(3)resources 或者(4)static application.yml 设置静态资源的访问路径 设置静态资源存 阅读全文
posted @ 2023-09-17 17:48 努力是一种常态 阅读(805) 评论(0) 推荐(0)
摘要:2023-09-17 spring: mvc: hiddenmethod: filter: enabled: true server: servlet: encoding: charset: UTF-8 force: true enabled: true 阅读全文
posted @ 2023-09-17 19:02 努力是一种常态 阅读(324) 评论(0) 推荐(0)
摘要:2023-09-17 package com.hh.springboot05.config; import com.hh.springboot05.bean.Pet; import org.springframework.context.annotation.Bean; import org.spr 阅读全文
posted @ 2023-09-17 21:50 努力是一种常态 阅读(287) 评论(0) 推荐(0)
摘要:2023-09-18 package com.hh.controller; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Controller; import org.springframework.w 阅读全文
posted @ 2023-09-18 16:52 努力是一种常态 阅读(389) 评论(0) 推荐(0)