@Configuration
public class RedisConfiguraion { @Bean
public JedisConnectionFactory redisConnectionFactory() {
RedisStandaloneConfiguration configuration = new RedisStandaloneConfiguration();
configuration.setHostName("ip地址");
configuration.setPort(6379);
//configuration.setPassword(RedisPassword.of("123456"));
return new JedisConnectionFactory(configuration);
} @Bean
public RedisTemplate redisTemplate(JedisConnectionFactory factory){
RedisTemplate redisTemplate = new RedisTemplate();
redisTemplate.setConnectionFactory(factory);
return redisTemplate;
}
}

基本的配置是这样的。

Spring注解方式配置Redis的更多相关文章

  1. spring注解方式配置以及spring4的泛型注入 (4)

    目录 一.@Controller 注解控制层(action) 二.@Service 注解服务层 三.@Repository 持久层 四.spring4的泛型注入测试 1 创建两个实体User和Role ...

  2. spring 注解方式配置Bean

    Spring能够从classpath下自动扫描,侦测和实例化具有特定注解的组件特定组件包括: @Component:基本注解,标示了一个受Spring管理的Bean组件 @Respository:标识 ...

  3. Spring boot 基于注解方式配置datasource

    Spring boot 基于注解方式配置datasource 编辑 ​ Xml配置 我们先来回顾下,使用xml配置数据源. 步骤: 先加载数据库相关配置文件; 配置数据源; 配置sqlSessionF ...

  4. SSH深度历险(十) AOP原理及相关概念学习+AspectJ注解方式配置spring AOP

    AOP(Aspect Oriented Programming),是面向切面编程的技术.AOP基于IoC基础,是对OOP的有益补充. AOP之所以能得到广泛应用,主要是因为它将应用系统拆分分了2个部分 ...

  5. Spring Aop实例@Aspect、@Before、@AfterReturning@Around 注解方式配置

    用过spring框架进行开发的人,多多少少会使用过它的AOP功能,都知道有@Before.@Around和@After等advice.最近,为了实现项目中的输出日志和权限控制这两个需求,我也使用到了A ...

  6. 跟着刚哥学习Spring框架--通过注解方式配置Bean(四)

    组件扫描:Spring能够从classpath下自动扫描,侦测和实例化具有特定注解的组件. 特定组件包括: 1.@Component:基本注解,识别一个受Spring管理的组件 2.@Resposit ...

  7. spring学习笔记 星球日two - 注解方式配置bean

    注解要放在要注解的对象的上方 @Autowired private Category category; <?xml version="1.0" encoding=" ...

  8. Spring框架学习(6)使用ioc注解方式配置bean

    内容源自:使用ioc注解方式配置bean context层 : 上下文环境/容器环境 applicationContext.xml 1 ioc注解功能 注解 简化xml文件配置 如 hibernate ...

  9. Spring配置文件中bean标签中init-method和destroy-method和用注解方式配置

    Person类: public class Person {       private int i = 0;          public Person(){           System.o ...

随机推荐

  1. vue 15分钟倒计时

    HTML: <span>{{minute}}:{{second}}</span> script: 一          二 // 倒计时 num(n) { return n & ...

  2. 《从Lucene到Elasticsearch:全文检索实战》学习笔记三

    今天我给大家讲讲倒排索引. 索引是构成搜索引擎的核心技术之一,它在日常生活中是非常常见的,比如我看一本书的时候,我首先会看书的目录,通过目录可以快速定位到具体章节的页码,加快对内容的查询速度. 文档通 ...

  3. message box

    QMessageBox 弹出框上的按钮设置为中文   Qt 默认的弹出框上的按钮式英文,虽然也知道是什么意思,但终究不如中文看着顺眼. QMessageBox box(QMessageBox::War ...

  4. 一篇关于CountDownLatch的好文章

    CountDownLatch简介 CountDownLatch是一种java.util.concurrent包下一个同步工具类,它允许一个或多个线程等待直到在其他线程操作执行完成. 使用场景: 在开发 ...

  5. because there was insufficient free space available after evicting expired cache entries

    Tomcat运行的时候哗哗哗的报警告 版本是Tomcat 8.5.15 告警信息关键字如下 because there was insufficient free space available af ...

  6. Mac 永久添加 环境变量方法

    在 ~ 目录下 新建 .bash_profile 文件 在文件新增 export PATH="$PATH:/Users/zhangpengchao/tools/flutter/flutter ...

  7. 1.3 Linux分区类型

    1.主分区最多只能有4个. 2.扩展分区: 最多只能有一个: 主分区加扩展分区最多只能有4个: 扩展分区只能包含逻辑分区,不能写数据. 3.格式化目的: 写入文件系统:清除数据:划出文件分配表(i n ...

  8. 阅读 video in to axi4-stream v4.0 笔记

    阅读 video in to axi4-stream v4.0 笔记 axi4 stream里面只传输的有效数据. 引用: 使能了video timing controller core 的所用信号, ...

  9. oracle user_tables没有新创建的表的问题

    oracle 新创建表后,在user_tables没有,在user_tab_columns也没有,暂时未找到办法

  10. Android Gradle 依赖方式

    Android Gradle 依赖方式有以下6种: Compile compile是对所有的build type以及favlors都会参与编译并且打包到最终的apk文件中. Provided Prov ...