下面列出了怎么用org.springframework.boot.context.properties.DeprecatedConfigurationProperty的API类实例代码及写法,或者点击链接到github查看源代码。
@Deprecated
@DeprecatedConfigurationProperty(
reason = "replaced to SentinelProperties#blockPage.",
replacement = SentinelConstants.PROPERTY_PREFIX + ".block-page")
public String getBlockPage() {
return blockPage;
}
/**
* recommend to use {@link NacosConfigProperties#sharedConfigs} .
* @return string
*/
@Deprecated
@DeprecatedConfigurationProperty(
reason = "replaced to NacosConfigProperties#sharedConfigs and not use it at the same time.",
replacement = PREFIX + ".shared-configs[x]")
public String getSharedDataids() {
return null == getSharedConfigs() ? null : getSharedConfigs().stream()
.map(Config::getDataId).collect(Collectors.joining(COMMAS));
}
/**
* Not providing support,the need to refresh is specified by the respective refresh
* configuration and not use it at the same time .
* @return string
*/
@Deprecated
@DeprecatedConfigurationProperty(
reason = "replaced to NacosConfigProperties#sharedConfigs and not use it at the same time.",
replacement = PREFIX + ".shared-configs[x].refresh")
public String getRefreshableDataids() {
return null == getSharedConfigs() ? null
: getSharedConfigs().stream().filter(Config::isRefresh)
.map(Config::getDataId).collect(Collectors.joining(COMMAS));
}
/**
* recommend to use
* {@link com.alibaba.cloud.nacos.NacosConfigProperties#extensionConfigs} and not use
* it at the same time .
* @return extensionConfigs
*/
@Deprecated
@DeprecatedConfigurationProperty(
reason = "replaced to NacosConfigProperties#extensionConfigs and not use it at the same time .",
replacement = PREFIX + ".extension-configs[x]")
public List<Config> getExtConfig() {
return this.getExtensionConfigs();
}
private void createComponentConfigurationSource(String packageName, ComponentModel model, String overrideComponentName) throws MojoFailureException {
int pos = model.getJavaType().lastIndexOf(".");
String name = model.getJavaType().substring(pos + 1);
name = name.replace("Component", "ComponentConfiguration");
final JavaClass javaClass = new JavaClass(getProjectClassLoader());
javaClass.setPackage(packageName);
javaClass.setName(name);
javaClass.extendSuperType("ComponentConfigurationPropertiesCommon");
javaClass.addImport("org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon");
// add bogus field for enabled so spring boot tooling can get the
// javadoc as description in its metadata
Property bogus = javaClass.addProperty("java.lang.Boolean", "enabled");
String scheme = overrideComponentName != null ? overrideComponentName : model.getScheme();
bogus.getField().getJavaDoc().setText("Whether to enable auto configuration of the " + scheme + " component. This is enabled by default.");
bogus.removeAccessor();
bogus.removeMutator();
String doc = "Generated by camel-package-maven-plugin - do not edit this file!";
if (!Strings.isNullOrEmpty(model.getDescription())) {
doc = model.getDescription() + "\n\n" + doc;
}
javaClass.getJavaDoc().setText(doc);
String prefix = "camel.component." + (overrideComponentName != null ? overrideComponentName : model.getScheme());
// make sure prefix is in lower case
prefix = prefix.toLowerCase(Locale.US);
javaClass.addAnnotation(Generated.class.getName()).setStringValue("value", SpringBootAutoConfigurationMojo.class.getName());
javaClass.addAnnotation("org.springframework.boot.context.properties.ConfigurationProperties").setStringValue("prefix", prefix);
for (ComponentOptionModel option : model.getComponentOptions()) {
if (skipComponentOption(model, option)) {
// some component options should be skipped
continue;
}
String type = option.getJavaType();
// generate inner class for non-primitive options
type = getSimpleJavaType(type);
// spring-boot auto configuration does not support complex types
// (unless they are enum, nested)
// and if so then we should use a String type so spring-boot and its
// tooling support that
// as Camel will be able to convert the string value into a lookup
// of the bean in the registry anyway
// and therefore there is no problem, eg
// camel.component.jdbc.data-source = myDataSource
// where the type would have been javax.sql.DataSource
boolean complex = isComplexType(option) && isBlank(option.getEnums());
if (complex) {
// force to use a string type
type = "java.lang.String";
}
Property prop = javaClass.addProperty(type, option.getName());
if (option.isDeprecated()) {
prop.getField().addAnnotation(Deprecated.class);
prop.getAccessor().addAnnotation(Deprecated.class);
prop.getMutator().addAnnotation(Deprecated.class);
// DeprecatedConfigurationProperty must be on getter when deprecated
prop.getAccessor().addAnnotation(DeprecatedConfigurationProperty.class);
}
if (!Strings.isNullOrEmpty(option.getDescription())) {
String desc = option.getDescription();
if (complex) {
if (!desc.endsWith(".")) {
desc = desc + ".";
}
desc = desc + " The option is a " + option.getJavaType() + " type.";
}
prop.getField().getJavaDoc().setFullText(desc);
}
if (!isBlank(option.getDefaultValue())) {
if ("java.lang.String".equals(option.getJavaType()) || "duration".equals(option.getType())) {
prop.getField().setStringInitializer(option.getDefaultValue().toString());
} else if ("long".equals(option.getJavaType()) || "java.lang.Long".equals(option.getJavaType())) {
// the value should be a Long number
String value = option.getDefaultValue() + "L";
prop.getField().setLiteralInitializer(value);
} else if ("integer".equals(option.getType()) || "java.lang.Integer".equals(option.getJavaType())
|| "boolean".equals(option.getType()) || "java.lang.Boolean".equals(option.getJavaType())) {
prop.getField().setLiteralInitializer(option.getDefaultValue().toString());
} else if (!isBlank(option.getEnums())) {
String enumShortName = type.substring(type.lastIndexOf(".") + 1);
prop.getField().setLiteralInitializer(enumShortName + "." + option.getDefaultValue());
javaClass.addImport(model.getJavaType());
}
}
}
String fileName = packageName.replaceAll("\\.", "\\/") + "/" + name + ".java";
writeSourceIfChanged(javaClass, fileName, true);
}
@Deprecated
@DeprecatedConfigurationProperty
public String getCommand() {
return command;
}
@Deprecated
@DeprecatedConfigurationProperty
public Boolean getCache() {
return cache;
}
@Deprecated
@DeprecatedConfigurationProperty
public Boolean getCache() {
return cache;
}
@Deprecated
@DeprecatedConfigurationProperty
public Long getConnectTimeoutMillis() {
return connectTimeoutMillis;
}
@Deprecated
@DeprecatedConfigurationProperty
public Long getReadTimeoutMillis() {
return readTimeoutMillis;
}
@Deprecated
@DeprecatedConfigurationProperty
public String getWriteTimeoutMillis() {
return writeTimeoutMillis;
}
@Deprecated
@DeprecatedConfigurationProperty
public String getComponentName() {
return componentName;
}
@DeprecatedConfigurationProperty(replacement = "spring.rabbitmq.listener.simple.acknowledge-mode")
@Deprecated
public AcknowledgeMode getAcknowledgeMode() {
return getSimple().getAcknowledgeMode();
}
@DeprecatedConfigurationProperty(replacement = "spring.rabbitmq.listener.simple.concurrency")
@Deprecated
public Integer getConcurrency() {
return getSimple().getConcurrency();
}
@DeprecatedConfigurationProperty(replacement = "spring.rabbitmq.listener.simple.default-requeue-rejected")
@Deprecated
public Boolean getDefaultRequeueRejected() {
return getSimple().getDefaultRequeueRejected();
}
@DeprecatedConfigurationProperty(replacement = "spring.rabbitmq.listener.simple.idle-event-interval")
@Deprecated
public Long getIdleEventInterval() {
return getSimple().getIdleEventInterval();
}
@DeprecatedConfigurationProperty(replacement = "spring.rabbitmq.listener.simple.max-concurrency")
@Deprecated
public Integer getMaxConcurrency() {
return getSimple().getMaxConcurrency();
}
@DeprecatedConfigurationProperty(replacement = "spring.rabbitmq.listener.simple.prefetch")
@Deprecated
public Integer getPrefetch() {
return getSimple().getPrefetch();
}
@DeprecatedConfigurationProperty(replacement = "spring.rabbitmq.listener.simple.retry")
@Deprecated
public ListenerRetry getRetry() {
return getSimple().getRetry();
}
@DeprecatedConfigurationProperty(replacement = "spring.rabbitmq.listener.simple.transaction-size")
@Deprecated
public Integer getTransactionSize() {
return getSimple().getTransactionSize();
}
@DeprecatedConfigurationProperty(replacement = "spring.rabbitmq.listener.simple.auto-startup")
@Deprecated
public boolean isAutoStartup() {
return getSimple().isAutoStartup();
}
@DeprecatedConfigurationProperty(replacement = "jiuxian.name-cn", reason = "deprecated")
public String getName() {
return getNameCn();
}
@DeprecatedConfigurationProperty(replacement = "Use host + port properties instead")
public String getHostPort() {
return hostPort;
}
@DeprecatedConfigurationProperty(reason = "不推荐使用 String 类型描述用户主页")
@Deprecated
public String getHomePage() {
return homePage;
}
@DeprecatedConfigurationProperty(replacement = "custom.connection.address")
@Deprecated
public String getServer() {
return getAddress();
}
@DeprecatedConfigurationProperty(reason = "not needed anymore", replacement = "none")
public String getDefaultSubject() {
return defaultSubject;
}
/**
* Tells if rate limit response headers should be added to response.
*
* @deprecated use {{@link #responseHeaders}
*/
@Deprecated
@DeprecatedConfigurationProperty(replacement = "zuul.ratelimit.response-headers")
public boolean isAddResponseHeaders() {
return !NONE.equals(responseHeaders);
}
@Deprecated
@DeprecatedConfigurationProperty(
reason = "Backend version no longer required. The kv version is determined during secret retrieval")
public int getBackendVersion() {
return this.backendVersion;
}
/**
* @deprecated use {@link org.flowable.spring.boot.process.FlowableProcessProperties#getServlet()#getPath()}
*/
@DeprecatedConfigurationProperty(replacement = "flowable.process.servlet.path")
@Deprecated
public String getRestApiMapping() {
throw new IllegalStateException("Usage of deprecated property. Use FlowableProcessProperties");
}
/**
* @deprecated use {@link org.flowable.spring.boot.process.FlowableProcessProperties#getServlet()#getName()}
*/
@DeprecatedConfigurationProperty(replacement = "flowable.process.servlet.name")
@Deprecated
public String getRestApiServletName() {
throw new IllegalStateException("Usage of deprecated property. Use FlowableProcessProperties");
}