Spring reads the Redis XML configuration file (configure IP, port, password)

When the redis bean is injected into the spring container, the IP and port are injected using the constructor, and the password is injected using the setting method:

<bean id="zwy_redisJedisShardInfo" class="redis.clients.jedis.JedisShardInfo">
        <constructor-arg name="host" value="*.*.*.*" />
        <constructor-arg name="port" value="*" />
        <property name="password" value="*"></property>
 </bean>

<constructor-arg>: Constructor injection

<property>: setting injection

 

About redis read xml configuration test:

Guess you like

Origin blog.csdn.net/zhangwenchao0814/article/details/108376239