|
|
|
@ -17,8 +17,15 @@ package org.redisson.micronaut;
|
|
|
|
|
|
|
|
|
|
import io.micronaut.context.annotation.ConfigurationBuilder;
|
|
|
|
|
import io.micronaut.context.annotation.ConfigurationProperties;
|
|
|
|
|
import io.micronaut.context.annotation.Parameter;
|
|
|
|
|
import io.micronaut.context.annotation.Requires;
|
|
|
|
|
import org.redisson.client.NettyHook;
|
|
|
|
|
import org.redisson.client.codec.Codec;
|
|
|
|
|
import org.redisson.config.*;
|
|
|
|
|
import org.redisson.connection.AddressResolverGroupFactory;
|
|
|
|
|
import org.redisson.connection.ConnectionListener;
|
|
|
|
|
|
|
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
@ -110,4 +117,65 @@ public class RedissonConfiguration extends Config {
|
|
|
|
|
protected void setMasterSlaveServersConfig(MasterSlaveServersConfig masterSlaveConnectionConfig) {
|
|
|
|
|
super.setMasterSlaveServersConfig(masterSlaveConnectionConfig);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ConfigurationBuilder(value = "codec1")
|
|
|
|
|
public Config setCodec(Codec codec) {
|
|
|
|
|
return super.setCodec(codec);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Config setCodec(String className) {
|
|
|
|
|
try {
|
|
|
|
|
Codec codec = (Codec) Class.forName(className).getDeclaredConstructor().newInstance();
|
|
|
|
|
return super.setCodec(codec);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new IllegalArgumentException(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ConfigurationBuilder(value = "nettyHook1")
|
|
|
|
|
public Config setNettyHook(NettyHook nettyHook) {
|
|
|
|
|
return super.setNettyHook(nettyHook);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Config setNettyHook(String className) {
|
|
|
|
|
try {
|
|
|
|
|
NettyHook nettyHook = (NettyHook) Class.forName(className).getDeclaredConstructor().newInstance();
|
|
|
|
|
return super.setNettyHook(nettyHook);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new IllegalArgumentException(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ConfigurationBuilder(value = "addressResolverGroupFactory1")
|
|
|
|
|
public Config setAddressResolverGroupFactory(AddressResolverGroupFactory addressResolverGroupFactory) {
|
|
|
|
|
return super.setAddressResolverGroupFactory(addressResolverGroupFactory);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Config setAddressResolverGroupFactory(String className) {
|
|
|
|
|
try {
|
|
|
|
|
AddressResolverGroupFactory value = (AddressResolverGroupFactory) Class.forName(className).getDeclaredConstructor().newInstance();
|
|
|
|
|
return super.setAddressResolverGroupFactory(value);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new IllegalArgumentException(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ConfigurationBuilder(value = "connectionListener1")
|
|
|
|
|
public Config setConnectionListener(ConnectionListener connectionListener) {
|
|
|
|
|
return super.setConnectionListener(connectionListener);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Config setConnectionListener(String className) {
|
|
|
|
|
try {
|
|
|
|
|
ConnectionListener connectionListener = (ConnectionListener) Class.forName(className).getDeclaredConstructor().newInstance();
|
|
|
|
|
return super.setConnectionListener(connectionListener);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new IllegalArgumentException(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|