Spring Boot Redis
1、配置pom.xml,增加redis依赖。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
2、application.properties 添加redis连接配置。
1、配置pom.xml,增加redis依赖。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
2、application.properties 添加redis连接配置。
1、配置pom.xml,增加mybatis依赖。
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.2</version>
</dependency>
2、applicati
一、Eclipse 部署应用war
1、配置pom.xml,增加packaging改成war。
2、将嵌入的Tomcat依赖方式改成provided,增加依赖项。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>prov
一、单数据源
1、配置pom.xml,增加jdbc、HikariCP连接池、MySQL驱动。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId&g
1、配置pom.xml。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
2、AOPConfig.java
package com.idodo.demo.conf;
import java.util.Arra
@Retention(RetentionPolicy.RUNTIME)
@Retention(保留)注解按照生命周期划分可以分为3类:
1、RetentionPolicy.SOURCE:注解只保留在源文件,当Java文件编译成class文件的时候,注解被遗弃。
2、RetentionPolicy.CLASS:注解被保留到class文件,但jvm加载class文件时候被遗弃。默认的生命周期。
3、RetentionPolicy.RUNTIME:注解不仅被保存到class文件中,在j
package com.idodo.demo.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* CopyRright (c)2018-2028:
修改类时,需要重启应用,不方便调试。打开pom文件,添加如下依赖,调整为热部署,spring-boot只加载变化的类。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</depe
一、Eclipse maven
1、maven构建项目。访问http://start.spring.io/
点击“Switch to the full version”,可以切换至详细配置。单击“Switch back to the simple version”返回简单配置。
2、点击Generate Project下载项目压缩包。
3、解压缩demo.zip。
4、导入工程。eclipse,Import -> Maven -> Existing Mave
package com.ssm.cts.test;
/**
* CopyRright (c)2018-2028: chanpinxue.cn
* Project: cts
* Module Name: QueueTest
* Comments: 队列
* JDK version used: JDK1.8
* Author: jzh
* Create Date: 2018-12-07
* Modified By: jzh
* Modified Date: 2
package com.ssm.cts.test;
/**
* CopyRright (c)2018-2028: chanpinxue.cn
* Project: cts
* Module Name: SLTest
* Comments: 单向链表
* JDK version used: JDK1.8
* Author: jzh
* Create Date: 2018-12-04
* Modified By: jzh
* Modified Date: 20
package com.ssm.cts.test;
/**
* CopyRright (c)2018-2028: chanpinxue.cn
* Project: cts
* Module Name: StackTest
* Comments: 栈
* JDK version used: JDK1.8
* Author: jzh
* Create Date: 2018-12-04
* Modified By: jzh
* Modified Date:
package com.ssm.cts.test;
/**
* CopyRright (c)2018-2028: chanpinxue.cn
* Project: cts
* Module Name: StackTest
* Comments: 栈
* JDK version used: JDK1.8
* Author: jzh
* Create Date: 2018-12-04
* Modified By: jzh
* Modified Date:
1、IDrawAPI.java
package com.ssm.cts.pattern.bridge;
public interface IDrawAPI {
public void drawCircle(String name);
}
2、RedCircle.java
package com.ssm.cts.pattern.bridge;
public class RedCircle implements IDrawAPI {
@Override
1、IShape.java
package com.ssm.cts.pattern.flyweight;
public interface IShape {
void draw();
}
2、Circle.java
package com.ssm.cts.pattern.flyweight;
public class Circle implements IShape {
private String color;
public Circle(Str
1、Expression.java
package com.ssm.cts.pattern.interpreter;
import java.util.HashMap;
public abstract class Expression {
// 解析公式和数值,其中var中的key值是是公式中的参数,value值是具体的数字
public abstract int interpreter(HashMap<String, Integer> var);
}
1、IAction.java
package com.ssm.cts.pattern.state;
public interface IAction {
public void setState(int state);
public void start();
public void stop();
}
2、Action.java
package com.ssm.cts.pattern.state;
public class Action impl
1、IComputerPart.java
package com.ssm.cts.pattern.visitor;
public interface IComputerPart {
public void accept(IComputerPartVisitor computerPartVisitor);
}
2、Keyboard.java
package com.ssm.cts.pattern.visitor;
public class Keyboard
1、Memento.java
package com.ssm.cts.pattern.memento;
public class Memento {
private String state = “”;
public Memento(String _state) {
this.state = _state;
}
public String getState() {
return state;
}
public void setState(String
1、Facade.java
package com.ssm.cts.pattern.facade;
public class Facade {
private ClassA a = new ClassA();
private ClassB b = new ClassB();
private ClassC c = new ClassC();
public void methodA(){
this.a.doSomethingA();
}
public voi