0

I am facing some issue while connecting Redis("Using Redisson") with spring boot. At aplication Start time show below error.

"org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisson' defined in class path resource [com/redisson/config/RedisConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.redisson.api.RedissonClient]: Factory method 'redisson' threw exception; nested exception is java.lang.IllegalArgumentException: Illegal character in scheme name at index 0: 127.0.0.1:6379"

MY code is only doing connection in spring @Bean only

package com.redisson.config;
> 
> import java.io.IOException;
> 
> import org.redisson.Redisson; import org.redisson.api.RedissonClient;
> import org.redisson.config.Config; import
> org.springframework.beans.factory.annotation.Value; import
> org.springframework.context.annotation.Bean; import
> org.springframework.context.annotation.ComponentScan; import
> org.springframework.context.annotation.Configuration;
> 
> @Configuration @ComponentScan({"com.redisson.config"}) public class
> RedisConfig {
> 
>   @Value("${spring.redis.url}")   String REDIS_URL;   
>   @Bean(destroyMethod="shutdown")
>     RedissonClient redisson() throws IOException {        System.out.println("Redis url"+REDIS_URL);
>         Config config = new Config();
>         //config.useClusterServers().addNodeAddress("127.0.0.1:6379");
>         config.useSingleServer().setAddress("127.0.0.1:6379");
>         return Redisson.create(config);
>     }
> 
> }
Nilesh Madhak
  • 13
  • 1
  • 1
  • 7

1 Answers1

3

It's an exception from java.net.URI. It occurs because you use an illegally formatted address. Try to change it to "redis://127.0.0.1:6379". It should resolve your problem.

Zap
  • 325
  • 1
  • 6
  • 23
  • thanks Alexander for your replay i will check.Please share exmaple link for How to create repository to Store data in in redis using redisson. – Nilesh Madhak Apr 28 '18 at 21:19
  • 1
    Sorry Nilesh, i can't. I've never used reddis, and i don't know what it is. I just viewed source code and found that solution. I hope what it helped. – Alexander Polozov Apr 28 '18 at 21:40