1.导入别人的maven工程,报错
The type org.springframework.core.NestedRuntimeException cannot be resolved.
It is indirectly referenced from required .class files
原因是:pom.xml缺少spring核心包的依赖
2.linux下启动redis
nohup /usr/local/redis-3.2.9/src/redis-server /usr/local/redis-3.2.9/redis.conf &
后台启动,输出日志到nohup.out
./redis-cli
在控制台输入命令
3.pom.xml
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>1.8.4.RELEASE</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.9.0</version>
</dependency>
4.spring配置文件
加约束
xmlns:p="http://www.springframework.org/schema/p"
<bean id="jedisConnFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
p:use-pool="true"
p:host-name="ip地址"
p:port="6379"/>
<!-- redis template definition -->
<bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate"
p:connection-factory-ref="jedisConnFactory" />