04 2021 档案

摘要:mybatis-config.xml <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd 阅读全文
posted @ 2021-04-18 13:30 川上富江 阅读(34) 评论(0) 推荐(0)
摘要:<dependencies> <!--Junit--> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> </dependency> <!--数据库驱动--> <d 阅读全文
posted @ 2021-04-18 13:07 川上富江 阅读(48) 评论(0) 推荐(0)
摘要:@RestController 下面的不走视图解析器 @ResponseBody//他就不会走视图解析器 会直接返回一个字符串 阅读全文
posted @ 2021-04-17 11:58 川上富江 阅读(69) 评论(0) 推荐(0)
摘要:Controller返回JSON数据 Jackson应该是目前比较好的json解析工具了 当然工具不止这一个,比如还有阿里巴巴的 fastjson 等等。 我们这里使用Jackson,使用它需要导入它的jar包; <!-- https://mvnrepository.com/artifact/com 阅读全文
posted @ 2021-04-17 11:56 川上富江 阅读(66) 评论(0) 推荐(0)
摘要:<form action="${pageContext.request.contextPath}/requ01" method="post"> 用户名<input type="text" name="user"> </br> 密码<input type="password" name="pwd">< 阅读全文
posted @ 2021-04-13 11:15 川上富江 阅读(54) 评论(0) 推荐(0)
摘要:不得不说,乱码问题是在我们开发中十分常见的问题,也是让我们程序猿比较头大的问题! 以前乱码问题通过过滤器解决 , 而SpringMVC给我们提供了一个过滤器 , 可以在web.xml中配置 . 修改了xml文件需要重启服务器! <filter> <filter-name>encoding</filt 阅读全文
posted @ 2021-04-12 19:59 川上富江 阅读(48) 评论(0) 推荐(0)
摘要:@Controller @RequestMapping("/User") public class UserController { @GetMapping("/t1") public String test1(@RequestParam("username") String name, Model 阅读全文
posted @ 2021-04-12 19:41 川上富江 阅读(54) 评论(0) 推荐(0)
摘要:学习测试 在新建一个类 RestFulController @Controller public class RestFulController {} 1 2 在Spring MVC中可以使用 @PathVariable 注解,让方法参数的值对应绑定到一个URI模板变量上。 @Controller 阅读全文
posted @ 2021-04-12 17:24 川上富江 阅读(66) 评论(0) 推荐(0)
摘要:xml 配置 <!--配置声明式事务--> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <constructor-arg ref="da 阅读全文
posted @ 2021-04-08 23:22 川上富江 阅读(99) 评论(0) 推荐(0)
摘要:编写实体类编写核心配置文件编写接口编写mapper.xml测试resources 下的db.properties driver=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/mybatis?&useUnicode=true&charact 阅读全文
posted @ 2021-04-08 14:02 川上富江 阅读(31) 评论(0) 推荐(0)
摘要:二 DiyPointCut.class public class DiyPointCut { public void before(){ System.out.println(" 在前 "); } public void after(){ System.out.println(" 在后 "); } 阅读全文
posted @ 2021-04-08 13:27 川上富江 阅读(56) 评论(0) 推荐(0)
摘要:applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/ 阅读全文
posted @ 2021-04-08 11:36 川上富江 阅读(34) 评论(0) 推荐(0)
摘要:Client.class public class Client { public static void main(String[] args) { //真实角色 Host host = new Host(); //代理角色 现在没有 ProxyInvoationHandle pih = new 阅读全文
posted @ 2021-04-08 10:25 川上富江 阅读(43) 评论(0) 推荐(0)
摘要:@Autowired 自动装配通过类型 名字 如果@Autowired不能唯一自动装配上属性,则需要@Qualifier(value="xxx") @Nullable 字段标记了这个注解 说明这个字段可以为Null @Resource 自动装配 名字 类型 @Component 组件 放在类上 说明 阅读全文
posted @ 2021-04-07 14:55 川上富江 阅读(53) 评论(0) 推荐(0)
摘要:自动装配说明 自动装配是使用spring满足bean依赖的一种方法 spring会在应用上下文中为某个bean寻找其依赖的bean。 Spring中bean有三种装配机制,分别是: 在xml中显式配置; 在java中显式配置; 隐式的bean发现机制和自动装配。 这里我们主要讲第三种:自动化的装配b 阅读全文
posted @ 2021-04-07 14:38 川上富江 阅读(234) 评论(0) 推荐(0)
摘要:单例模式(spring默认机制) 原型模式:每次从容器中get的时候都会 产生一个新对象 阅读全文
posted @ 2021-04-06 22:17 川上富江 阅读(49) 评论(0) 推荐(0)
摘要:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance 阅读全文
posted @ 2021-04-06 20:53 川上富江 阅读(42) 评论(0) 推荐(0)
摘要:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance 阅读全文
posted @ 2021-04-06 19:37 川上富江 阅读(58) 评论(0) 推荐(0)
摘要:xml文件 <settings> <setting name="logImpl" value="STDOUT_LOGGING"/> <!-- 是否开启驼峰命名自动映射,即从经典数据库列名 A_COLUMN 映射到经典 Java 属性名 aColumn--> <setting name="mapUnd 阅读全文
posted @ 2021-04-03 18:15 川上富江 阅读(38) 评论(0) 推荐(0)