Skip to content

Commit

Permalink
Avoid clashes with default parser defined in CamelAutoConfiguration
Browse files Browse the repository at this point in the history
  • Loading branch information
Croway committed May 6, 2024
1 parent 37e55a6 commit 2e3b326
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.springframework.core.ResolvableType;
import org.springframework.core.convert.ConversionService;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.Environment;
import org.springframework.core.env.MutablePropertySources;
import org.springframework.core.env.PropertyResolver;

Expand Down Expand Up @@ -111,8 +112,8 @@ public EncryptablePropertySourcesPlaceholderConfigurer propertyConfigurer(String
@Bean
@ConditionalOnMissingBean(PropertiesParser.class)
public PropertiesParser encryptedPropertiesParser(PropertyResolver propertyResolver,
StringEncryptor stringEncryptor) {
return new JasyptSpringEncryptedPropertiesParser(propertyResolver, stringEncryptor);
StringEncryptor stringEncryptor, Environment env) {
return new JasyptSpringEncryptedPropertiesParser(propertyResolver, stringEncryptor, env);
}

public SaltGenerator getSaltGenerator(JasyptEncryptedPropertiesConfiguration configuration) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,28 @@
*/
package org.apache.camel.component.jasypt.springboot;

import org.apache.camel.component.properties.DefaultPropertiesParser;
import org.apache.camel.component.properties.PropertiesLookup;
import org.apache.camel.spring.boot.SpringPropertiesParser;
import org.jasypt.encryption.StringEncryptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.core.env.PropertyResolver;

import static org.jasypt.properties.PropertyValueEncryptionUtils.isEncryptedValue;
import static org.jasypt.properties.PropertyValueEncryptionUtils.decrypt;

public class JasyptSpringEncryptedPropertiesParser extends DefaultPropertiesParser {
public class JasyptSpringEncryptedPropertiesParser extends SpringPropertiesParser {

private PropertyResolver propertyResolver;

private StringEncryptor stringEncryptor;

@Autowired
public JasyptSpringEncryptedPropertiesParser(PropertyResolver propertyResolver, StringEncryptor stringEncryptor) {
public JasyptSpringEncryptedPropertiesParser(
PropertyResolver propertyResolver,
StringEncryptor stringEncryptor,
Environment env) {
super(env);
this.propertyResolver = propertyResolver;
this.stringEncryptor = stringEncryptor;
}
Expand Down

0 comments on commit 2e3b326

Please sign in to comment.