Spring Boot 1.2.3
kullanıyorum ve @ConfigurationProperties
ile açıklamalı bir fasulye içine enjekte edilmeden önce bir özellik değerinin şifresini çözmek mümkün olup olmadığını anlamak istiyorum.@ConfigurationProperties beans'de kullanılan özellikleri nasıl çözebilirim?
varsayalım Bir application.properties
dosyasında aşağıdaki vardır:
appprops.encryptedProperty=ENC(ENCRYPTEDVALUE)
ve örnek uygulama şöyle: Bunu başarmak için özel bir PropertySourcesPlaceholderConfigurer
kullandım Geçmişte
package aaa.bb.ccc.propertyresearch;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import javax.annotation.PostConstruct;
@SpringBootApplication
@EnableConfigurationProperties(PropertyResearchApplication.ApplicationProperties.class)
public class PropertyResearchApplication {
public static void main(String[] args) {
SpringApplication.run(PropertyResearchApplication.class, args);
}
@ConfigurationProperties("appprops")
public static class ApplicationProperties {
private String encryptedProperty;
@PostConstruct
public void postConstruct() throws Exception {
System.out.println("ApplicationProperties --> appprops.encryptedProperty = " + encryptedProperty);
}
public String getEncryptedProperty() {
return encryptedProperty;
}
public void setEncryptedProperty(String encryptedProperty) {
this.encryptedProperty = encryptedProperty;
}
}
}
ancak aşağıdaki gibi bir yapının kurulmasını gerektirir:
Bu ve kendi başına kötü değil iken ben şifreli özellikleri ile @ConfigurationProperties
niceleri kaldırabilir görmek istiyorum.
bunu gördün mü: /: http://stackoverflow.com/questions/24451110/creating-a-custom-jasypt-propertysource-in-springboot – koe
OP http cevabını buldu /stackoverflow.com/a/24486190/4094797. Lütfen çözümü bulmak için bağlantıyı kontrol edin. – user2339071