ulisesbocchio / jasypt-spring-boot

Jasypt integration for Spring boot
MIT License
2.87k stars 514 forks source link

Is there an unresolvable circular reference #372

Closed wang-sheng-pu1002 closed 1 year ago

wang-sheng-pu1002 commented 1 year ago
    <dependency>
        <groupId>com.github.ulisesbocchio</groupId>
        <artifactId>jasypt-spring-boot-starter</artifactId>
        <version>3.0.5</version>
    </dependency>
org.springframework.boot spring-boot-starter-parent 2.3.12.RELEASE

Customize EncryptablePropertyDetector and EncryptablePropertyResolver

@Value("${AAAAA:123456}") String password;
@Bean(name="encryptablePropertyResolver")
EncryptablePropertyResolver encryptablePropertyResolver() {
    return new LBPropertyResolver(password);
}

The project failed to start, I suspect it is an injection issue: @Value("${AAAAA:123456}") String password;But I don't know how to solve it. Could you please help me take a look.

Project error message

2023-09-08 08:59:12.810 INFO [,,,] 32240 --- [ main] ptablePropertiesBeanFactoryPostProcessor : Post-processing PropertySource instances 2023-09-08 08:59:12.816 INFO [,,,] 32240 --- [ main] c.u.j.EncryptablePropertySourceConverter : Skipping PropertySource configurationProperties [class org.springframework.boot.context.properties.source.ConfigurationPropertySourcesPropertySource 2023-09-08 08:59:12.819 INFO [,,,] 32240 --- [ main] c.u.j.EncryptablePropertySourceConverter : Converting PropertySource bootstrap [org.springframework.core.env.MapPropertySource] to EncryptableMapPropertySourceWrapper 2023-09-08 08:59:12.820 INFO [,,,] 32240 --- [ main] c.u.j.EncryptablePropertySourceConverter : Converting PropertySource systemProperties [org.springframework.core.env.PropertiesPropertySource] to EncryptableMapPropertySourceWrapper 2023-09-08 08:59:12.820 INFO [,,,] 32240 --- [ main] c.u.j.EncryptablePropertySourceConverter : Converting PropertySource systemEnvironment [org.springframework.boot.env.SystemEnvironmentPropertySourceEnvironmentPostProcessor$OriginAwareSystemEnvironmentPropertySource] to EncryptableSystemEnvironmentPropertySourceWrapper 2023-09-08 08:59:12.821 INFO [,,,] 32240 --- [ main] c.u.j.EncryptablePropertySourceConverter : Converting PropertySource random [org.springframework.boot.env.RandomValuePropertySource] to EncryptablePropertySourceWrapper 2023-09-08 08:59:12.822 INFO [,,,] 32240 --- [ main] c.u.j.EncryptablePropertySourceConverter : Converting PropertySource springCloudClientHostInfo [org.springframework.core.env.MapPropertySource] to EncryptableMapPropertySourceWrapper 2023-09-08 08:59:12.822 INFO [,,,] 32240 --- [ main] c.u.j.EncryptablePropertySourceConverter : Converting PropertySource defaultProperties [org.springframework.core.env.MapPropertySource] to EncryptableMapPropertySourceWrapper 2023-09-08 08:59:12.933 INFO [,,,] 32240 --- [ main] c.u.j.filter.DefaultLazyPropertyFilter : Property Filter custom Bean not found with name 'encryptablePropertyFilter'. Initializing Default Property Filter 2023-09-08 08:59:12.938 INFO [,,,] 32240 --- [ main] c.u.j.r.DefaultLazyPropertyResolver : Property Resolver custom Bean not found with name 'encryptablePropertyResolver'. Initializing Default Property Resolver 2023-09-08 08:59:12.940 INFO [,,,] 32240 --- [ main] c.u.j.d.DefaultLazyPropertyDetector : Property Detector custom Bean not found with name 'encryptablePropertyDetector'. Initializing Default Property Detector

. _ _ /\ / '_ () \ \ \ \ ( ( )\ | ' | '| | ' \/ ` | \ \ \ \ \/ _)| |)| | | | | || (| | ) ) ) ) ' |__| .|| ||| |\, | / / / / =========|_|==============|__/=//// :: Spring Boot :: (v2.3.12.RELEASE)

2023-09-08 08:59:17.486 INFO [,,,] 32240 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode! 2023-09-08 08:59:17.490 INFO [,,,] 32240 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Redis repositories in DEFAULT mode. 2023-09-08 08:59:17.538 INFO [,,,] 32240 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 21ms. Found 0 Redis repository interfaces. 2023-09-08 08:59:18.170 INFO [,,,] 32240 --- [ main] ptablePropertiesBeanFactoryPostProcessor : Post-processing PropertySource instances 2023-09-08 08:59:18.171 INFO [,,,] 32240 --- [ main] c.u.j.EncryptablePropertySourceConverter : Converting PropertySource ApolloBootstrapPropertySources [org.springframework.core.env.CompositePropertySource] to EncryptableEnumerablePropertySourceWrapper 2023-09-08 08:59:18.171 INFO [,,,] 32240 --- [ main] c.u.j.EncryptablePropertySourceConverter : Converting PropertySource ApolloPropertySources [org.springframework.core.env.CompositePropertySource] to EncryptableEnumerablePropertySourceWrapper 2023-09-08 08:59:18.172 INFO [,,,] 32240 --- [ main] c.u.j.EncryptablePropertySourceConverter : Skipping PropertySource configurationProperties [class org.springframework.boot.context.properties.source.ConfigurationPropertySourcesPropertySource 2023-09-08 08:59:18.172 INFO [,,,] 32240 --- [ main] c.u.j.EncryptablePropertySourceConverter : Skipping PropertySource servletConfigInitParams [class org.springframework.core.env.PropertySource$StubPropertySource 2023-09-08 08:59:18.172 INFO [,,,] 32240 --- [ main] c.u.j.EncryptablePropertySourceConverter : Skipping PropertySource servletContextInitParams [class org.springframework.core.env.PropertySource$StubPropertySource 2023-09-08 08:59:18.172 INFO [,,,] 32240 --- [ main] c.u.j.EncryptablePropertySourceConverter : Converting PropertySource systemProperties [org.springframework.core.env.PropertiesPropertySource] to EncryptableMapPropertySourceWrapper 2023-09-08 08:59:18.172 INFO [,,,] 32240 --- [ main] c.u.j.EncryptablePropertySourceConverter : Converting PropertySource systemEnvironment [org.springframework.boot.env.SystemEnvironmentPropertySourceEnvironmentPostProcessor$OriginAwareSystemEnvironmentPropertySource] to EncryptableSystemEnvironmentPropertySourceWrapper 2023-09-08 08:59:18.172 INFO [,,,] 32240 --- [ main] c.u.j.EncryptablePropertySourceConverter : Converting PropertySource random [org.springframework.boot.env.RandomValuePropertySource] to EncryptablePropertySourceWrapper 2023-09-08 08:59:18.172 INFO [,,,] 32240 --- [ main] c.u.j.EncryptablePropertySourceConverter : Converting PropertySource springCloudClientHostInfo [org.springframework.core.env.MapPropertySource] to EncryptableMapPropertySourceWrapper 2023-09-08 08:59:18.173 INFO [,,,] 32240 --- [ main] c.u.j.EncryptablePropertySourceConverter : Converting PropertySource applicationConfig: [classpath:/application.properties] [org.springframework.boot.env.OriginTrackedMapPropertySource] to EncryptableMapPropertySourceWrapper 2023-09-08 08:59:18.173 INFO [,,,] 32240 --- [ main] c.u.j.EncryptablePropertySourceConverter : Converting PropertySource applicationConfig: [classpath:/application.yml] [org.springframework.boot.env.OriginTrackedMapPropertySource] to EncryptableMapPropertySourceWrapper 2023-09-08 08:59:18.173 INFO [,,,] 32240 --- [ main] c.u.j.EncryptablePropertySourceConverter : Converting PropertySource springCloudDefaultProperties [org.springframework.core.env.MapPropertySource] to EncryptableMapPropertySourceWrapper 2023-09-08 08:59:18.174 INFO [,,,] 32240 --- [ main] c.u.j.EncryptablePropertySourceConverter : Converting PropertySource cachedrandom [org.springframework.cloud.util.random.CachedRandomPropertySource] to EncryptablePropertySourceWrapper 2023-09-08 08:59:18.174 INFO [,,,] 32240 --- [ main] c.u.j.EncryptablePropertySourceConverter : Converting PropertySource defaultProperties [org.springframework.core.env.MapPropertySource] to EncryptableMapPropertySourceWrapper 2023-09-08 08:59:18.291 INFO [,,,] 32240 --- [ main] c.u.j.filter.DefaultLazyPropertyFilter : Property Filter custom Bean not found with name 'encryptablePropertyFilter'. Initializing Default Property Filter 08:59:18.372 [main] ERROR org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter -


APPLICATION FAILED TO START


Description:

Failed to bind properties under 'spring.shardingsphere.masterslave.load-balance-algorithm-type' to java.lang.String:

Reason: Error creating bean with name 'encryptablePropertyResolver': Requested bean is currently in creation: Is there an unresolvable circular reference?

Action:

Update your application's configuration

wang-sheng-pu1002 commented 1 year ago

I further added custom filters to address this issue, but I think the shelf should eliminate the custom configuration on its own

jason-lindholm commented 9 months ago

This appears to be broken in 3.0.5 as well

nated099 commented 8 months ago

3.0.5 doesn't seem to fix this issue unfortunately