Bonjour a tous , alors j'ai une application avec netty
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 
public class NettyServer {
 
	private int port;
 
	private NettyServer(int port) {
		this.port = port;
	}
 
	public static void main(String[] args) throws Exception {
			new NettyServer(8050).run();
	}
 
	private void run() throws Exception {
		EventLoopGroup bossGroup = new NioEventLoopGroup();
		EventLoopGroup workerGroup = new NioEventLoopGroup();
		try {
			ServerBootstrap serverBootstrap = new ServerBootstrap();
			serverBootstrap.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class)
					.childHandler(new ChannelInitializer<SocketChannel>() {
						@Override
						public void initChannel(SocketChannel ch) throws Exception {
							ch.pipeline().addLast(new RequestDecoderServer(), new ResponseEncoderServer(),new AuthenticateHandler(),
									new ProcessingHandler());
						}
					}).option(ChannelOption.SO_BACKLOG, 128).childOption(ChannelOption.SO_KEEPALIVE, true);
			System.out.println("Netty pratique de odotrack serveur sur le port " + port);
			ChannelFuture f = serverBootstrap.bind(port).sync();
			f.channel().closeFuture().sync();
		} finally {
			workerGroup.shutdownGracefully();
			bossGroup.shutdownGracefully();
		}
	}
}
est ce qu il est possible de faire de l'injection Spring dans un ChannelInboundHandlerAdapter
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

public class AuthenticateHandler extends ChannelInboundHandlerAdapter {

	@Autowired
	private UserService userService;
	@Autowired
	private RoleService roleService;

	
	@Override
	public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
		System.out.println("serveur netty Classe ProcessingHandler et methode  channelRead");
		System.out.println(msg);
		// String trame = (String) msg;
		
		super.channelRead(ctx, msg);
	}
}
Pour que je puisse injecter des services avec spring merci d avance