ulisesbocchio / jasypt-spring-boot

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

1.17 version of jasypt-spring-boot-starter not work #69

Closed Comven closed 6 years ago

Comven commented 6 years ago

I use starter of version 1.17 with spring-cloud,it not auto configure ,unless @EnableEncryptableProperties was configured,but when I use 1.16,it worked fine。Is there anything wrong?

kand617 commented 6 years ago

I second this. the 1.17 does not work as expected. 1.16 works as per instructions.

ulisesbocchio commented 6 years ago

Alright might be a regression. Let me take a look

wangyanrui commented 6 years ago

same question it doesn't work with spring cloud environment if version is 1.17 (1.16 is fine) but it could work without spring cloud

qrqhuang commented 6 years ago

same issue in cloud env with 1.17 wait for solution

ulisesbocchio commented 6 years ago

can you guys please provide a code sample where it doesn't work? I tested every single module from the sample projects against jasypt-spring-boot 1.17 and Spring Boot Versions 1.5.10, 2.0.0.M2 and 2.0.0.M7 I found no errors.

wangyanrui commented 6 years ago

main class

@EnableEurekaServer
@SpringBootApplication
public class EurekaServerApplication {

    public static void main(String[] args) {
        ApplicationContext ctx =  SpringApplication.run(EurekaServerApplication.class, args);
    }
}

yml content

spring:
    application:
        name: eurekaServer

eureka:
    instance:
        hostname: localhost
    client:
        registerWithEureka: false
        fetchRegistry: false
        serviceUrl:
            defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/

jasypt:
    encryptor:
        password: chinesevory@163.com

security:
    basic:
        enabled: true
    user:
        name: ENC(sHV0EyVQChGylv+ca+1v5A==)
        password: ENC(ik738nnCouT/li3/h8+zPeo2NY4ghxwz1axI216qlpg=)

Program arguments

--server.port=8761 --eureka.server.enable-self-preservation=false

POM.xml content

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.10.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
    <spring-cloud.version>Edgware.RELEASE</spring-cloud.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-eureka-server</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>

    <dependency>
        <groupId>com.github.ulisesbocchio</groupId>
        <artifactId>jasypt-spring-boot-starter</artifactId>
        <!-- it doesn't work with spring cloud environment if version is 1.17 -->
        <version>1.16</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>${spring-cloud.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>
Comven commented 6 years ago

When i run it at spring-cloud environment with default configuration,I can‘t find the log like this Encryptor config not found for property jasypt.encryptor.algorithm, using default value: PBEWithMD5AndDES Encryptor config not found for property jasypt.encryptor.keyObtentionIterations, using default value: 1000 Encryptor config not found for property jasypt.encryptor.poolSize, using default value: 1 Encryptor config not found for property jasypt.encryptor.providerName, using default value: null Encryptor config not found for property jasypt.encryptor.saltGeneratorClassname, using default value: org.jasypt.salt.RandomSaltGenerator Encryptor config not found for property jasypt.encryptor.stringOutputType, using default value: base64

unless i add @EnableEncryptableProperties .

wangyanrui commented 6 years ago

@Comven The same situation. if add @EnableEncryptableProperties, it worked fine.

Comven commented 6 years ago

I find a way can work fine,where use 1.17 version,the parameter wich we want to decrypt must be configured at bootstrap.properties instead of application.properties. if we configure it at application.properties, it will decrypt fail. It's not reasonable. please have a look! @ulisesbocchio.

ulisesbocchio commented 6 years ago

Just released 1.18, please validate the fix when It's available in maven central and let me know

ulisesbocchio commented 6 years ago

@Comven @wangyanrui @qrqhuang can any of you guys validate the fix please?

wangyanrui commented 6 years ago

@ulisesbocchio 1.18 works fine! Thanks!

Comven commented 6 years ago

It runs perfectly.

ulisesbocchio commented 6 years ago

Awesome! Thanks guys!