Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String Encryptor custom Bean not found with name 'jasyptStringEncryptor' even when bean exists in the config #51

Closed
SureshTak opened this issue Jun 21, 2017 · 3 comments

Comments

@SureshTak
Copy link

Hi,
I am using jasypt spring boot starter plug in and added custom String Encryptor bean defination to the AppConfig file but still I get the String Encryptor custom Bean not found with name 'jasyptStringEncryptor' error in the logs and always it picking up default jasypt encryption config values.

Please help me why spring not picking up my custom encryption config values.

Spring boot version is -1.5.4.RELEASE
Jayspt version is -com.github.ulisesbocchio:jasypt-spring-boot-starter:1.12

My Bean definition looks like below.

@Bean(name="jasyptStringEncryptor")
	static public PooledPBEStringEncryptor stringEncryptor() {
		PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
		SimpleStringPBEConfig config = new SimpleStringPBEConfig();
		config.setPassword("password");
		config.setAlgorithm("PBEWithMD5AndDES");
		  @@config.setKeyObtentionIterations("1000");
		config.setPoolSize("1");
		config.setProviderName("SunJCE");
		config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator");
		config.setStringOutputType("base64");
		encryptor.setConfig(config);
		return encryptor;
	}

log:
2017-06-20 21:53:29.921 INFO 16560 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'jasyptStringEncryptor' with a different defin
ition: replacing [Root bean: class [com....AppConfig]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factor
yBeanName=null; factoryMethodName=stringEncryptor; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/
///AppConfig.class]] with [Root bean:
class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=com.ulisesbocchio.jasyptspringboot.con
figuration.EncryptablePropertyResolverConfiguration; factoryMethodName=stringEncryptor; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/ulisesbo
cchio/jasyptspringboot/configuration/EncryptablePropertyResolverConfiguration.class]]
2017-06-20 21:53:29.925 WARN 16560 --- [ main] o.s.c.a.ConfigurationClassPostProcessor : Cannot enhance @configuration bean definition 'beanNamePlaceholderRegistryPostProc
essor' since its singleton instance has been created too early. The typical cause is a non-static @bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declari
ng such methods as 'static'.

2017-06-20 21:53:31.406 INFO 16560 --- [ main] EncryptablePropertyResolverConfiguration : String Encryptor custom Bean not found with name 'jasyptStringEncryptor'. Initiali
zing String Encryptor based on properties with name 'jasyptStringEncryptor'
2017-06-20 21:53:31.425 INFO 16560 --- [ main] c.u.j.encryptor.DefaultLazyEncryptor : Encryptor config not found for property jasypt.encryptor.algorithm, using default
value: PBEWithMD5AndDES

@SureshTak SureshTak changed the title String Encryptor custom Bean not found with name 'jasyptStringEncryptor' even bean exisits String Encryptor custom Bean not found with name 'jasyptStringEncryptor' even when bean exists in the config Jun 21, 2017
@SureshTak
Copy link
Author

@ulisesbocchio

@ulisesbocchio
Copy link
Owner

this is fixed in MASTER, dup of #48

@SureshTak
Copy link
Author

Thanks for fix. I will pull the latest library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants