Enable configuration properties by scanning (#7413)

#### What type of PR is this?

/kind improvement
/area core
/milestone 2.20.x

#### What this PR does / why we need it:

This PR change the enable method of configuration properties from `EnableConfigurationProperties` to `ConfigurationPropertiesScan`. This way can decouple the add of configuration properties.

See https://docs.spring.io/spring-boot/reference/features/external-config.html#features.external-config.typesafe-configuration-properties.enabling-annotated-types for more.

#### Does this PR introduce a user-facing change?

```release-note
None
```
pull/7418/head
John Niang 2025-05-08 14:07:42 +08:00 committed by GitHub
parent caf172786c
commit 9c6ff9184e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 3 deletions

View File

@ -4,9 +4,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.metrics.buffering.BufferingApplicationStartup;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
import org.springframework.scheduling.annotation.EnableScheduling;
import run.halo.app.infra.properties.HaloProperties;
/**
* Halo main class.
@ -19,7 +18,7 @@ import run.halo.app.infra.properties.HaloProperties;
@EnableScheduling
@SpringBootApplication(scanBasePackages = "run.halo.app", exclude =
IntegrationAutoConfiguration.class)
@EnableConfigurationProperties({HaloProperties.class})
@ConfigurationPropertiesScan(basePackages = "run.halo.app.infra.properties")
public class Application {
public static void main(String[] args) {