not registered via @EnableConfigurationProperties or marked as Spring component
package controller; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@EnableAutoConfiguration
@RestController
@RequestMapping
@ConfigurationProperties(prefix = "book")
public class BookController {
// @Value("${book.author}")
private String author;
//
// @Value("${book.name}")
private String name; @RequestMapping("/bookInfo")
public String showInfo(){
return author + ":" + name;
} }
book:
author: Tom
name: Springboot
package controller; import org.springframework.boot.SpringApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties; @EnableConfigurationProperties({BookController.class})
public class DemoConfig {
public static void main(String[] args) { SpringApplication.run(BookController.class,args);
}
}
not registered via @EnableConfigurationProperties or marked as Spring component的更多相关文章
- Spring @ Component 的作用
1.@controller 控制器(注入服务) 2.@service 服务(注入dao) 3.@repository dao(实现dao访问) 4.@component (把普通pojo实例化到spr ...
- spring @Component
使用 @Component <context:component-scan base-package="dao" /> 虽 然我们可以通过@Autowired或@R ...
- Spring @Component的作用详细介绍
@component 作用 1.@controller 控制器(注入服务)2.@service 服务(注入dao)3.@repository dao(实现dao访问)4.@component (把普通 ...
- spring @component的作用
该文转载自:http://tomfish88.iteye.com/blog/1497557 1.@controller 控制器(注入服务) 2.@service 服务(注入dao) 3.@reposi ...
- 转!!spring @component 详解 默认初始化bean的名字 VNumberTask类 就是 VNumberTask
参考链接:信息来源 今天碰到一个问题,写了一个@Service的bean,类名大致为:CUser xml配置: <context:component-scan base-package=&quo ...
- Spring @Component 注解的使用
使用说明 这个注解用于声明当前的类是一个组件类,Spring 会通过类路径扫描来自动侦测和自动装配这些组件,创建一个个 bean 后,注册到 Spring 容器中. 带 @Component 注解的类 ...
- Spring Component注解处理过程
接下来: org.springframework.context.annotation.ComponentScanBeanDefinitionParser#parse方法展开加载过程:
- Spring @Component生成bean名称的规则(当类的名字是以两个或以上的大写字母开头的话,bean的名字会与类名保持一致
正确注入方式: @Autowired private TFeeMapper TFeeMapper; 错误注入方式 @Autowired private TFeeMapper tFeeMapper; 这 ...
- SpringBoot @ConfigurationProperties报错
idea报错如下: Not registered via @EnableConfigurationProperties or marked as Spring component less... (C ...
随机推荐
- 一、数据库、SQL简介
1.数据库简介 1.1数据库:保存有组织的数据的容器(通常是一个文件或一组文件) 数据库软件:称为数据库管理系统(DBMS),数据库是通过DBMS创建和操纵的.通常用户使用DBMS访问数据库. 表:表 ...
- EF 线程内唯一对象
ef 做了很多修改后一起提交 增 删 改查 也就是相应的操作后不提交最后一起提交 在Dal层创建一个 EF上下文工厂 public class DBContextFactory { public st ...
- Python 内置函数&filter()&map()&reduce()&sorted()
常用内置函数 Python 2.x 返回列表,Python 3.x 返回迭代器 在进行筛选或映射时,输出的结果是一个数组,需要list帮助. 如:print(list(map(lambda x:x+1 ...
- jetson nano VNC
寻找比较好的远程桌面方式,最新系统里有写. ======================================================================= README ...
- PushSharp 由于远程方已关闭传输流,身份验证失败。
前段时间用到了PushSharp给APNS发推送,但是用的时候遇见很诡异的事情,每次第一次运行的时候能成功发送到 但是接下来就无限的提示“由于远程方已关闭传输流,身份验证失败. “ 然后我就各种找原因 ...
- redis数据库操作
一.String(字符串)操作 String在redis中的存储是按照key-value的形式存储 1.SET key value [EX seconds] [PX milliseconds] [NX ...
- Redis探索之路(七):Redis高级使用特性
一:安全性 设置客户端连接后进行任何其他指定前需要使用的密码. 因为Redis的速度非常之快,一台比较好的服务器下,一个外部的用户可以在1s内进行15万次的密码尝试连接,这就意味着你需要指定非常强大的 ...
- 泛型(Generic)接口
泛型接口例子:一个学生有一个独一无二的ID,但是每个学生的姓名不一定是唯一的. class Program { static void Main(string[] args) { Student< ...
- Jmeter-【beanshell处理器】-随机数(数字、字母、特殊符号、混合)
一.自定义函数
- 区别 |python-pandas库set_index、reset_index用法区别
1.set_index() 作用:DataFrame可以通过set_index方法,将普通列设置为单索引/复合索引. 格式:DataFrame.set_index(keys, drop=True, a ...