我有一个ENUM
为
package com.myorg.sparrow.s3Environment;
import javax.annotation.Nonnull;
public enum DocumentType {
Document("document/", ".xml.gz", "binary/octet-stream", "gzip", true);
private final String path;
private final String suffix;
private final String contentType;
private final String contentEncoding;
private final Boolean compress;
private DocumentType(@Nonnull final String path, @Nonnull final String suffix,
@Nonnull final String contentType, @Nonnull final String contentEncoding,
@Nonnull final Boolean compress) {
this.path = path;
this.suffix = suffix;
this.contentType = contentType;
this.contentEncoding = contentEncoding;
this.compress = compress;
}
@Nonnull
public String getPath() {
return path;
}
@Nonnull
public String getSuffix() {
return suffix;
}
@Nonnull
public String getContentType() {
return contentType;
}
@Nonnull
public String getContentEncoding() {
return contentEncoding;
}
@Nonnull
public Boolean isCompress() {
return compress;
}
}
Run Code Online (Sandbox Code Playgroud)
我想DocumentType.Document
在Spring
配置文件中注入此值
<bean id="s3Service" class="com.myorg.sparrow.business.xml.persist.S3Service">
<constructor-arg ref="awsCredentials" />
<constructor-arg value="**DocumentType.DOCUMENT**" /> // how do I inject it here?
<constructor-arg value="${com.myorg.sparrow.s3EnvironmentConfiguration.S3EnvironmentConfigurator-destBucketName}" />
</bean>
Run Code Online (Sandbox Code Playgroud)
我如何注入此值
<constructor-arg value="**DocumentType.DOCUMENT**" /> // how do I inject it here?
Run Code Online (Sandbox Code Playgroud)
我是Spring框架的新手,不知道如何实现这一点
谢谢
MK.*_*MK. 14
<bean id="s3Service" class="com.myorg.sparrow.business.xml.persist.S3Service">
<constructor-arg ref="awsCredentials" />
<constructor-arg value="Document" /> // We love Spring because it is simpler than we expect
<constructor-arg value="${com.myorg.sparrow.s3EnvironmentConfiguration.S3EnvironmentConfigurator-destBucketName}" />
</bean>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
13300 次 |
最近记录: |