自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

xiewz1112的博客

请与我共享知识的盛宴

  • 博客(19)
  • 收藏
  • 关注

原创 SpringMVC学习--1 以一个实例开始

实例组成: 1、pom.xml:maven文件标明依赖和build插件。 2、logback.xml:配置logback日志,主要由根节点configuration、子节点、、组成。 3、index.jsp:用于展示的jsp文件。 4、@Configuration、@EnableMvc注解的配置类:使能MVC,并装配ViewResolver的Bean,用于将逻辑视图创建生成物理视图。 5...

2018-05-30 23:22:10 91

原创 spring学习--13 condition

采用@Conditional和接口Condition实现基于条件的Bean的创建,可代替active的profile。一般用于多态下的Bean的创建。示例如下。1. 通过接口Condition定义条件window操作系统条件package com.condition;import org.springframework.context.annotation.Condition;...

2018-05-29 18:18:27 118

原创 spring学习--14 总结

关键概念: 1、依赖注入:通过组合,而非继承关系,由Spring IoC container(ApplicationContext)管理注入所需Bean,实现Bean直接的解耦合。 2、Java配置:通过@Configuration和@Bean实现,取代复杂的xml配置方式。如果配置类有@ComponentScan注解,并且被扫描的类具有@Component、@Repository、@Serv...

2018-05-29 17:11:46 105

原创 spring学习--12 @Enable*注解工作原理

所有@Enable*已经注解的元注解中均包含@Import注解,@Import用于导入配置类,因此@Enable*注解通过导入配置类实现*所标注功能的使能。如@EnableAsync、@EnableScheduling、@EnableAspectJAutoProxy等等。 导入配置类方式分为三种: 1、直接导入配置类,如@EnableScheduling导入SchedulingConfigur...

2018-05-29 15:45:09 402

原创 spring学习--11 composed annotation and meta annotation

组合注解与其注解的注解具有相同的作用1. 组合注解package com.annotation;import java.lang.annotation.Documented;import java.lang.annotation.ElementType;import java.lang.annotation.Retention;import java.lang.annotat...

2018-05-29 15:19:40 185

原创 spring学习--10 Scheduled

难度:一颗星1. Scheduled servicepackage com.schedule;import java.text.SimpleDateFormat;import java.util.Date;import org.springframework.scheduling.annotation.Scheduled;import org.springframework...

2018-05-28 23:43:40 89

原创 spring学习--9 多任务

spring采用TaskExecutor完成多任务处理工作和并发编程,可以使用TheadPoolTaskExecutor创建一个基于线程池的TaskExecutor。如下例所示。1、Configuration类package com.taskexecutor;import java.util.concurrent.Executor;import org.springframew...

2018-05-28 21:20:48 211

原创 Spring学习--8 aware

Spring Awarespring aware包括BeanNameAware、BeanFactoryAware、ApplicationContextAware、MessageSourceAware、ApplicationEventPublisherAware、ResourceLoaderAware等,采用spring aware可获取Spring容器本身的功能资源,不利之处在于将Bean与S...

2018-05-28 20:13:34 123

原创 spring学习--7 event

过程:定义一个event和一个listener,再在event publisher class中通过ApplicationEvent.publishEvent(java.lang.Object event)方法发布事件。1、Eventpackage com.event;import org.springframework.context.ApplicationEvent;pub...

2018-05-28 16:16:26 122

原创 spring学习--6 profile

1、激活Profile的几种方式Spring通过两个不同属性来决定哪些profile可以被激活(注意:profile是可以同时激活多个的),一个属性是spring.profiles.active和spring.profiles.default。这两个常量值在Spring的AbstractEnvironment中有定义,查看AbstractEnvironment源码: /** ...

2018-05-28 14:01:53 152

原创 Spring学习--5 Bean生命周期管理

Bean生命周期管理目的:掌握Bean生命周期管理方法,主要是标明initMethod和destroyMethod方法。 两种形式可用来管理Bean的初始化和销毁,一种是在配置中采用@Bean注解,@Bean(initMethod=”INIT_METHOD”, destroyMethod=”DESTROY_METHOD”);另外一种是在Bean的方法上分别注解@PostConstruct和@...

2018-05-28 10:07:18 116

原创 Spring学习--4 集合属性注入

Spring中��Bean中注入集合属性时,首先将一系列的基本类型和对象注入到集合中,再将集合注入Bean中。<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/20...

2018-05-25 15:56:11 416

原创 Spring学习--3 EL和资源调用

Spring学习–3 EL和资源调用目的:学习掌握EL和资源调用方法。 过程:通过编程学习实现。 工具:Spring tool suit 难度:一颗星1、同classpath下编写test.txt和test.properties文件,前者内容自定,后者满足格式即可,如:book.author=Cruisebook.name=spring boot2、编写Service...

2018-05-24 13:47:26 183

原创 Spring学习--2 aop

Spring学习–2 aop演示了aop的两种拦截方式:基于注解规则拦截和基于方法规则进行拦截。 步骤:添加依赖->编写基于注解拦截的规则->被拦截类->切面->java配置类->bootrap类添加依赖(pom.xml)<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="h...

2018-05-23 14:22:22 84

原创 二分搜索

package com.test;public class BinarySearch { private BinarySearch() {} //test public static void main(String[] args) { Integer[] x = new Integer[]{-1, 0, 3, 5, 6, 9, 10, 23, 45,...

2018-05-21 21:19:25 76

原创 冒泡排序(加速)

package com.test;import java.util.Arrays;import java.util.Comparator;public class BubbleSort { private BubbleSort() { } // test public static void main(String[] args) { I...

2018-05-21 20:44:59 433

原创 模拟echo服务器

模拟echo服务器:package com.test;import java.io.BufferedReader;import java.io.InputStreamReader;import java.io.OutputStreamWriter;import java.io.PrintWriter;import java.net.ServerSocket;import java...

2018-05-21 11:19:05 177

原创 列出目录下文件名称

import java.io.FileWriter;import java.io.IOException;import java.io.PrintWriter;import java.nio.file.FileVisitResult;import java.nio.file.Files;import java.nio.file.Path;import java.nio.file.Pat...

2018-05-17 09:38:52 297

原创 列出目录下所有文件和目录

列出目录下所有文件和目录import java.io.File;public class Test { public static void main(String[] args) throws Exception { showDirectory(new File("/Users/apple/redis")); } private stati...

2018-05-16 21:15:02 1889

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除