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

浙公网安备 33010602011771号