chore: Refactor services

- OpenSSL and Truststore services should not be Beans by default
- Instead, they are using auto configurations to register the beans
This commit is contained in:
Magnus Leßmann (@MarkL4YG) 2024-11-23 20:37:17 +01:00
parent 8856d8773e
commit 3620a12872
Signed by: Mark.TwoFive
GPG key ID: 5B5EBCBE331F1E6F
7 changed files with 63 additions and 9 deletions

View file

@ -0,0 +1,26 @@
package de.mlessmann.certassist.openssl;
import de.mlessmann.certassist.service.ExecutableResolver;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class AutoBootOpenSSL {
@Bean
@ConditionalOnMissingBean(CertificatePasswordProvider.class)
public CertificatePasswordProvider usageProvider() {
return new InMemoryCertificatePasswordProvider();
}
@Bean
@ConditionalOnMissingBean(CertificatePasswordProvider.class)
public OpenSSLCertificateCreator openSSLProvider(
ExecutableResolver executableResolver,
CertificatePasswordProvider passwordProvider,
CertificateProvider usageProvider
) {
return new OpenSSLCertificateCreator(executableResolver, passwordProvider, usageProvider);
}
}