Could not autowire. No beans of 'int' type found. less... (Ctrl+F1) Checks autowiring problems in a bean class.
package com.cxy.netty.controller; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelInitializer; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioServerSocketChannel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.autoconfigure.web.ServerProperties; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import java.net.InetSocketAddress; @Component public class NettyServer { private int port; public int getPort() { return port; } public void setPort(int port) { this.port = port; } public NettyServer(int port) { this.port = port; } public void start() throws Exception { System.out.println("启动记载netty"); EventLoopGroup boss = new NioEventLoopGroup(); EventLoopGroup work = new NioEventLoopGroup(); ServerBootstrap b = new ServerBootstrap(); b.group(boss,work) .channel(NioServerSocketChannel.class) .localAddress(new InetSocketAddress(port)) .childHandler(new ChannelInitializer<SocketChannel>() { @Override protected void initChannel(SocketChannel ch) throws Exception { ch.pipeline().addLast(new EchoServerHandler()); } }); System.out.println("启动加载netty2"); ChannelFuture channelFuturef = b.bind().sync(); if (channelFuturef.isSuccess()){ System.out.println("启动成功"); } } }
可以看到这个地方报错,笔者以为是idea的问题,所以强行启动,也还是报错,
仔细阅读了下,错误:
Could not autowire. No beans of 'int' type found. less... (Ctrl+F1) Checks autowiring problems in a bean class.
这个bean无法被注入,代表这个bean是被spring管理的,然后post无法找到,
这个bean初始化的时候需要传入参数,所有spring是无法找到这个参数,所以报了这个错,
那么解决方法:首先,看你这个bean是否想被spring管理,如果不想,那么就就行将注解除去就好如果想被管理,那么就可以额加上,然后添加这个值
Could not autowire. No beans of 'int' type found. less... (Ctrl+F1) Checks autowiring problems in a bean class.的更多相关文章
- Could not autowire. No beans of 'TbItemMapper' type found. less... (Ctrl+F1) Checks autowiring prob
Intellij Idea开发工具在@Autowired或者@Resource注入XxxMapper接口时报如下错误: Could not autowire. No beans of 'TbItemM ...
- Could not autowire. No beans of 'TbAssetsMapper' type found. less... (Ctrl+F1) Inspection info:Checks autowiring problems in a bean class.
报错:Could not autowire. No beans of 'TbAssetsMapper' type found. less... (Ctrl+F1) Inspection info:Ch ...
- IntelliJ Idea取消Could not autowire. No beans of 'xxxx' type found的错误提示
1.问题描述 在Idea的spring工程里,经常会遇到Could not autowire. No beans of 'xxxx' type found的错误提示.但程序的编译和运行都是没有问题的, ...
- Could not autowire. No beans of 'xxxx' type found的错误
在Idea的spring工程里,经常会遇到Could not autowire. No beans of 'xxxx' type found的错误提示.但程序的编译和运行都是没有问题的,这个错误提示并 ...
- IntelliJ Idea设置Could not autowire. No beans of 'xxx' type found
1.问题描述 在Idea的spring工程里,经常会遇到Could not autowire. No beans of ‘xxxx’ type found的错误提示.但程序的编译和运行都是没有问题的, ...
- IntelliJ Idea解决Could not autowire. No beans of 'xxxx' type found的错误提示
本文转自:http://blog.csdn.net/u012453843/article/details/54906905 1.问题描述 在Idea的spring工程里,经常会遇到Could not ...
- 【转】IntelliJ Idea取消Could not autowire. No beans of 'xxxx' type found的错误提示
1.问题描述 在Idea的spring工程里,经常会遇到Could not autowire. No beans of 'xxxx' type found的错误提示.但程序的编译和运行都是没有问题的, ...
- SpringBoot注入Mapper提示Could not autowire. No beans of 'xxxMapper' type found错误
通过用Mabatis的逆向工程生成的Entity和Mapper.在Service层注入的时候一直提示Could not autowire. No beans of 'xxxMapper' type f ...
- IDEACould not autowire. No beans of 'xxxMapper' type found.
作为一名刚开始使用idea的新手,最近在使用maven+springMVC框架时遇到了这样一个问题:Could not autowire. No beans of 'xxxMapper' type f ...
随机推荐
- 10个Eclipse珍藏插件推荐
1.Open Explorer 打开资源管理器插件,这是一个从Eclipse里面可以直接定位打开windows资源管理器文件的插件,这个版本的插件在最新的Eclipse版本中都能使用. 下载地址:ht ...
- mac bash上显示git分支与状态
主要实现 显示当前路径 显示当前所在分支 显示当前修改状态 = 表示一个干净的分支 ~ 表示文件有改动 # 表示已commit 但未 push 通过网上搜索和自己根据实际需要修改的代码如下: .bas ...
- unique(去重函数)
去重排序(unique函数的使用) 2013年05月30日 11:05:45 阅读数:9689更多 个人分类: 字符串处理 出处:http://www.cnblogs.com/QQbai/archi ...
- spring 事物(三)—— 声明式事务管理详解
spring的事务处理分为两种: 1.编程式事务:在程序中控制事务开始,执行和提交:详情请点此跳转: 2.声明式事务:在Spring配置文件中对事务进行配置,无须在程序中写代码:(建议使用) 我对&q ...
- 2018-8-10-win10-uwp-横向-AppBarButton
title author date CreateTime categories win10 uwp 横向 AppBarButton lindexi 2018-08-10 19:16:50 +0800 ...
- 安装双系统Windows+Centos安装完成之后提示双系统选项菜单!
原因:在windows下安装centos系统完成之后重启无法显示windows系统菜单选项 1.安装Windows系统 2.安装Centos系统 3.在Centos系统中安装ntfs-3g yum i ...
- Thinkphp5.0 自定义命令command的使用
在app下的command文件中,定义命令所在的模块以及命名. 然后保存,打开cmd,php think 定义的那个command的名字,完整的命令行为:php think clearInvalidO ...
- php递归无限分类、根据子类获取所有顶类
//递归无限分类树 public static function diGui($data, $pid) { $arr = collect([]); if (empty($data)) { return ...
- WGCNA构建基因共表达网络详细教程
这篇文章更多的是对于混乱的中文资源的梳理,并补充了一些没有提到的重要参数,希望大家不会踩坑. 1. 简介 1.1 背景 WGCNA(weighted gene co-expression networ ...
- 【leetcode】994. Rotting Oranges
题目如下: In a given grid, each cell can have one of three values: the value 0 representing an empty cel ...