![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Spring
CodeBoyWLC
技术+原理爱好者
展开
-
【Spring】事务管理:声明式事务管理:基于注解
public class TestBook { @Test public void testAccount() { ApplicationContext context = new ClassPathXmlApplicationContext("bean1.xml"); UserService userService = context.getBean("userService", UserServi原创 2021-05-16 23:16:06 · 60 阅读 · 0 评论 -
【Spring】事务管理:声明式事务管理:基于xml
public class TestBook { @Test public void testAccount() { ApplicationContext context = new ClassPathXmlApplicationContext("bean1.xml"); UserService userService = context.getBean("userService", UserServi原创 2021-05-16 23:15:10 · 62 阅读 · 0 评论 -
【Spring】JdbcTemplate:批量操作
public interface BookDao { public void add(Book book); public void delete(String id); public void myupdate(Book book); public int findSelect(); public Book findObjectSelect(String id); public List<Book> findListBook(); public void batchA原创 2021-05-16 23:13:10 · 180 阅读 · 0 评论 -
【Spring】JdbcTemplate:插入+修改+删除
package com.test.dao;public interface BookDao { public void add(Book book); public void delete(String id); public void myupdate(Book book);} package com.test.dao;import org.springframework.beans.factory.annotation.Autowired;import org.springf原创 2021-05-16 23:26:09 · 214 阅读 · 0 评论 -
【Spring】JdbcTemplate:插入
package com.test.dao;public class Book { private String userId; private String username; private String ustatus; public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getUs.原创 2021-05-15 23:21:16 · 652 阅读 · 0 评论 -
【Spring】JdbcTemplate:DAO模式
DROP TABLE IF EXISTS `tb_user`;CREATE TABLE `tb_user` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(45) NOT NULL, `age` int(10) unsigned NOT NULL, `sex` varchar(45) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB AUTO_INCREMENT=1.原创 2021-05-15 23:19:19 · 118 阅读 · 0 评论 -
【Spring】AspectJ:基于注解的声明式AspectJ
package com.itheima.jdk;public interface UserDao { public void addUser(); public void deleteUser();}package com.itheima.jdk;import org.springframework.stereotype.Repository;@Repository("userDao")public class UserDaoImpl implements UserDao {// 目标类原创 2021-05-15 23:16:52 · 191 阅读 · 0 评论 -
【Spring】AspectJ:基于XML的声明式AspectJ
package com.itheima.jdk;public interface UserDao { public void addUser(); public void deleteUser();}package com.itheima.jdk;import org.springframework.stereotype.Repository;// 目标类@Repository("userDao")public class UserDaoImpl implements UserDao原创 2021-05-15 23:14:28 · 260 阅读 · 0 评论 -
【Spring】引入外部属性文件
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:util="http://www.s原创 2021-05-15 23:10:24 · 155 阅读 · 0 评论 -
【Spring】Bean的装配--基于Annotation装配bean
package com.itheima.annotation;public interface UserDao { public void save();}package com.itheima.annotation;import org.springframework.stereotype.Repository;@Repository("userDao") //DAO层的类标识为beanpublic class UserDaoImpl implements UserDao{原创 2021-05-15 23:09:25 · 187 阅读 · 0 评论 -
【Spring】Bean的装配--基于XML的装配
––设值注入:通过反射调用setXxx注入属性值package com.itheima.assemble;import java.util.List;public class User { private String username; private Integer password; private List<String> list; /** * 设值注入 * 提供默认空参构造方法 ; * 为所有属性提供setter方法。 */ public User原创 2021-05-15 23:06:56 · 184 阅读 · 1 评论 -
【Spring】创建Bean
––用构造器<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springf原创 2021-05-15 23:04:25 · 61 阅读 · 0 评论 -
【Spring】Bean的作用域:singleton
共享同1个bean实例public class TestSpring5 { @Test public void test3() { ApplicationContext context = new ClassPathXmlApplicationContext("createBean.xml"); Course course = context.getBean("course", Course.class);原创 2021-05-15 23:04:37 · 75 阅读 · 0 评论 -
【Spring】实现AOP==>基于注解实现
package com.test.dao;import org.junit.Test;import org.springframework.context.ApplicationContext;import org.springframework.context.support.ClassPathXmlApplicationContext;public class TestAop { @Test public void testAopAnno() { Applic原创 2021-05-03 09:25:36 · 53 阅读 · 0 评论 -
【Spring】实现AOP==>基于xml实现
package com.test.dao;public class Book { public void buy() { System.out.println("buy............."); }}package com.test.dao;public class BookProxy { public void before() { //前置通知 System.out.println("before.........");原创 2021-05-02 19:37:50 · 43 阅读 · 0 评论 -
【Spring】JDK动态代理
package com.test.controller;import org.junit.Test;import org.springframework.context.ApplicationContext;import org.springframework.context.annotation.AnnotationConfigApplicationContext;import org.springframework.context.support.ClassPathXmlApplication.原创 2021-05-02 19:35:16 · 44 阅读 · 0 评论 -
【Spring】Webflux==>WebClient
package demo;import java.io.IOException;import org.springframework.http.MediaType;import org.springframework.web.reactive.function.client.WebClient;import reactor.core.publisher.Flux;import reactor.core.publisher.Mono;public class Client { publ原创 2021-05-02 19:32:57 · 75 阅读 · 0 评论 -
【Spring】Webflux实现==>基于函数式编程模型
package com.example.demo;import org.springframework.web.reactive.function.server.RouterFunction;import org.springframework.web.reactive.function.server.RouterFunctions;import org.springframework.web.reactive.function.server.ServerRequest;import org.s原创 2021-05-02 19:31:23 · 157 阅读 · 0 评论 -
【Spring】Webflux实现==>基于注解编程模型
package com.example.demo;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplicationpublic class SsnApplication{ public static void main(String[] args) { Sprin原创 2021-05-02 19:29:50 · 150 阅读 · 0 评论 -
【Spring】Webflux--响应式编程:用Reactor实现
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion&原创 2021-05-02 19:27:54 · 273 阅读 · 0 评论 -
【Spring】Webflux--响应式编程
①Java实现package reactor;import java.util.Observable;public class ObserverDemo extends Observable{ public static void main(String[] args) { ObserverDemo observer=new ObserverDemo(); //添加观察者 observer.addObserver((o,arg)->{ System.out.printl原创 2021-05-02 19:26:28 · 97 阅读 · 0 评论