Not registered via @EnableConfigurationProperties, | A component required a bean of type ‘xxx‘

Not registered via @EnableConfigurationProperties, marked as Spring component
This error is reported when using @ConfigurationProperties
insert image description here
Solution:
1. Add dependencies in pom.xml:

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

2. Add the @Component annotation to your corresponding class
insert image description here
so that there is no problem. If you do not solve the problem and change this prompt to Warning, this error will be reported at runtime

Description:
A component required a bean of type ‘com.czxy.changgou4.config.JwtProperties’ that could not be found.
Action:
Consider defining a bean of type ‘com.czxy.changgou4.config.JwtProperties’ in your configuration.

insert image description here

Guess you like

Origin blog.csdn.net/weixin_48143996/article/details/122196007