Package io.hekate.spring.boot.network
Annotation Type InjectConnector
-
@Autowired @Qualifier @Documented @Retention(RUNTIME) @Target({FIELD,PARAMETER,ANNOTATION_TYPE}) public @interface InjectConnector
Provides support forNetworkConnector
s autowiring.This annotation can be placed on any
autowire
-capable elements (fields, properties, parameters, etc) of application beans in order to injectNetworkConnector
by itsprotocol name
.Below is the example of how this annotation can be used.
1) Define a bean that will use
InjectConnector
annotation to injectNetworkConnector
into its field.@Component public class MyBean { @InjectConnector("my-connector") private NetworkConnector<Object> connector; // ... other fields and methods... }
@EnableHekate @SpringBootApplication public class MyApp { @Bean public NetworkConnectorConfig<Object> networkConnectorConfig() { return new NetworkConnectorConfig<>() .withProtocol("my-connector") .withServerHandler((msg, from) -> System.out.println("Got message " + msg + " from " + from) ); } // ... other beans and methods... }
- See Also:
HekateNetworkServiceConfigurer
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description String
value
Specifies theprotocol name
of aNetworkConnector
that should be injected (seeNetworkService.connector(String)
).
-
-
-
Element Detail
-
value
String value
Specifies theprotocol name
of aNetworkConnector
that should be injected (seeNetworkService.connector(String)
).- Returns:
- Protocol name of a
NetworkConnector
.
-
-