@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. 通过父元素的hover控制子元素的显示

    .searbar_content_box:hover .searchBar_checked_detail_box{ display:block}

  2. kolla单节点部署openstack

    virtualbox环境: 双网卡:enp0s3(桥接)   192.168.102.194 enp0s8(桥接)   无ip 块存储  50G 关闭防火墙,selinux. 配置yum源:wget  ...

  3. 【转】python两个 list 获取交集,并集,差集的方法

    1. 获取两个list 的交集: #方法一: a=[2,3,4,5] b=[2,5,8] tmp = [val for val in a if val in b] print tmp #[2, 5] ...

  4. Django请求流程图

    Django请求流程图

  5. design_patterns_in_typescript 学习

    https://github.com/torokmark/design_patterns_in_typescript Creational Singleton [A class of which on ...

  6. JVM的基本结构及其各部分详解(二)

    3.2 栈帧组成之操作数栈 操作数栈是栈帧的主要内容之一,它主要用于保存计算过程中的中间结果,同时作为计算过程中变量临时的存储空间. 操作数栈也是一个先进后出的数据结构,只支持入栈和出栈两种操作,许多 ...

  7. springboot解决跨域问题

    在启动类里加入corsFilter import org.springframework.boot.SpringApplication; import org.springframework.boot ...

  8. 浅谈JavaScript函数重载

    上个星期四下午,接到了网易的视频面试(前端实习生第二轮技术面试).面了一个多小时,自我感觉面试得很糟糕的,因为问到的很多问题都很难,根本回答不上来.不过那天晚上,还是很惊喜的接到了HR面电话.现在HR ...

  9. OkHttp官方中文文档

    https://blog.csdn.net/jackingzheng/article/details/51778793 https://www.cnblogs.com/ldq2016/p/879630 ...

  10. Delphi2009之TImage

    TPngImage原来是SourceFroge上的一个开源项目,现在突然消失了,为什么呢?Nick 在他的博客上写到:TPNGImage被CodeGear/Embarcadero收购了,现在直接就是D ...