07 2012 档案

摘要:java笔记1(策略、代理模式、枚举、反射、注解)一个简单策略模式示例的实现1.策略模式的组成2.策略模式的实现3.策略械的编写步骤注:java中的Collections 就是策略模式的一个实现, 其中的很多方法通过传入不同的比较器,实现不同形式的比较。4.定义一个实体类package com.vvvv.strategy;public class Person{ private int id; private String name; private int age; …………get/set方法…………}5.定义策略接口package com.vvvv.strategy;import java 阅读全文
posted @ 2012-07-31 21:37 维唯为为 阅读(624) 评论(0) 推荐(0) 编辑
摘要:说明 把配置信息,存储在配置的Bean中,再把Bean以集合的形式存储于Map当中,再将Map转成Json字符串,存储于集合当中。 配置工具类 配置工具类,用于获得配置信息存储配置信息 ConfigUtil.javapackage com.vvvv.musicsns.util; import com.google.gson.Gson; ... 阅读全文
posted @ 2012-07-30 20:13 维唯为为 阅读(333) 评论(0) 推荐(0) 编辑
摘要:1.经典的创建线程与启动线程1.建一个如下的Runable子类:Runnable runnable =new Runnable(){ publicvoid run(){ System.out.println("Run"); }}2.实例化一个Thread来执行这个线程More info see: Java Concurrency Tutorial2.运用线程池1.示例1,Future存于list中This is very simple and clean, but what if you’ve several long running tasks that you want 阅读全文
posted @ 2012-07-28 15:00 维唯为为 阅读(452) 评论(1) 推荐(0) 编辑
摘要:mysql 脚本: sql脚本use information_schema; drop database if exists lampssell; create database lampssell; use lampssell; /********系统部分**********//*** 用户表 */drop table ... 阅读全文
posted @ 2012-07-16 22:06 维唯为为 阅读(137) 评论(0) 推荐(0) 编辑
摘要:1.定义任务执行者2.构造任务、调度任务/** 26 * job service implements 27 * User: luowei 28 * Date: 12-7-8 29 * Time: 下午12:58 30 */31 @Service("jobService") 32 public class JobServiceImpl implements JobService { 33 34 @Autowired 35 NewestMusicService newestMusicService; 36 37 @Autowired 38 HotestMusicService 阅读全文
posted @ 2012-07-15 15:50 维唯为为 阅读(750) 评论(0) 推荐(0) 编辑
摘要:1.使用TreeMap<K,V>实现对Map<K,V>排序TreeMap中,是实现了对key的排序,不能根据value的大小来排序,其中的K,必须实现一个可比较的接口。1. TreepMap通过传入比较器的构造方法 public TreeMap(Comparator<? super K> comparator) { this.comparator = comparator; } 2.也可以通过comparator()方法传入 public Comparator<? super K> comparator() { return comparator 阅读全文
posted @ 2012-07-15 15:15 维唯为为 阅读(1008) 评论(0) 推荐(0) 编辑