Свойства моей библиотеки нельзя было разрешить, даже если я добавляю файл автоматического конфигурации и файл свойств для каждой функции в мою библиотеку. class = "lang-xml prettyprint-override">
Код: Выделить всё
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
org.springframework.boot
spring-boot-starter-parent
3.4.5
io.github.speedkillsx
checkcommonlib
0.0.5
Check Common Library
Demo project for Spring Boot
jar
The Apache License, Version 2.0
http://www.apache.org/licenses/LICENSE-2.0.txt
repo
scm:git:git://github.com/speedKillsx/checkcommonlib.git
scm:git:ssh://git@github.com/speedKillsx/checkcommonlib.git
https://github.com/speedKillsx/checkcommonlib
HEAD
17
org.springframework.boot
spring-boot-starter-web
org.projectlombok
lombok
true
org.springframework.boot
spring-boot-starter-test
test
org.springframework.boot
spring-boot-starter-aop
org.apache.maven.plugins
maven-compiler-plugin
org.projectlombok
lombok
org.sonatype.central
central-publishing-maven-plugin
0.7.0
true
ossrh
true
published
org.apache.maven.plugins
maven-javadoc-plugin
3.6.3
attach-javadocs
jar
org.apache.maven.plugins
maven-source-plugin
3.2.1
attach-sources
jar
org.apache.maven.plugins
maven-gpg-plugin
1.5
sign-artifacts
verify
sign
ossrh
https://oss.sonatype.org/service/local/staging/deploy/maven2/
ossrh
https://oss.sonatype.org/content/repositories/snapshots/
< /code>
мой файл автоматической конфигурации в библиотеке: < /p>
package io.github.speedkillsx.checkcommonlib.config;
import io.github.speedkillsx.checkcommonlib.properties.AuditProperties;
import io.github.speedkillsx.checkcommonlib.properties.LogExecutionTimeProperties;
import io.github.speedkillsx.checkcommonlib.properties.RetryOnFailurePropreties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
/**
* CheckCommonAutoConfiguration is a Spring configuration class that
* auto-configures beans related to common functionalities such as
* auditing, logging execution time, and retry mechanisms. These functionalities
* are managed through properties prefixed with "check-common" and loaded from
* the application's configuration file.
*
* It integrates configuration support for the following types of properties:
* - {@link AuditProperties} for enabling or disabling auditing features.
* - {@link LogExecutionTimeProperties} for enabling or disabling method execution time logging.
* - {@link RetryOnFailurePropreties} for configuring retry mechanisms in case of failures.
*
* The class enables AspectJ auto-proxy support and ensures that the
* necessary configuration beans are available for components relying on
* these common features.
*/
@Configuration
@EnableConfigurationProperties({
AuditProperties.class,
LogExecutionTimeProperties.class,
RetryOnFailurePropreties.class
})
@EnableAspectJAutoProxy
public class CheckCommonAutoConfiguration {
}
< /code>
Файлы свойств: < /p>
@Getter
@Setter
@ConfigurationProperties(prefix = "check-common")
public class AuditProperties {
private boolean auditEnable;
}
< /code>
@Getter
@Setter
@ConfigurationProperties(prefix = "check-common.retry")
public class RetryOnFailurePropreties {
private boolean enabled;
private int defaultMaxAttempts;
private long defaultDelayMs;
}
< /code>
@Getter
@Setter
@ConfigurationProperties(prefix = "check-common")
public class LogExecutionTimeProperties {
private boolean logExecutionTime;
}
Код: Выделить всё
4.0.0
org.springframework.boot
spring-boot-starter-parent
3.4.5
com.testcommonlib
demo
0.0.1-SNAPSHOT
demo
Demo project for Spring Boot
17
sonatype-releases
https://oss.sonatype.org/content/repositories/releases/
sonatype-snapshots
https://oss.sonatype.org/content/repositories/snapshots/
org.springframework.boot
spring-boot-starter-web
org.springframework.boot
spring-boot-starter-test
test
io.github.speedkillsx
checkcommonlib
0.0.5
org.projectlombok
lombok
1.18.38
provided
org.springframework.boot
spring-boot-maven-plugin
Код: Выделить всё
server:
port: 8087
spring:
application:
name: demo
check-common:
audit-enable: true
< /code>
check-commonПодробнее здесь: https://stackoverflow.com/questions/796 ... pplication