注入@ConfigurationProperties(prefix = "limit")报错

来源:4-1 项目属性配置知多少

None_null

2019-09-04

图片描述

添加过:

<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-configuration-processor</artifactId>
	<optional>true</optional>
</dependency>

没用.

spring boot的版本也对:

 <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.3.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

也重启过idea,但是就是不行

写回答

2回答

None_null

提问者

2019-09-04

已解决,添加注解:@Component


1
0

Bug总是难免的

2019-11-22

@Configuration注解代表配置比较好,虽然component也能达到同样的效果

0
0

2小时快速上手Spring Boot

一切为了效率!两个小时学习SpringBoot,为你省时省力Get干货

11582 学习 · 249 问题

查看课程