title: Loading decrypted Password with Jasypt in Spring Boot
body: <p>I'm trying to setup the Jasypt workflow with Spring Boot. As described in <a href="https://github.com/ulisesbocchio/jasypt-spring-boot#what-to-do-first" rel="nofollow noreferrer">this Tutorial</a>, I added the required dependency:</p>
  <pre><code>&lt;dependency&gt;
          &lt;groupId&gt;com.github.ulisesbocchio&lt;/groupId&gt;
          &lt;artifactId&gt;jasypt-spring-boot-starter&lt;/artifactId&gt;
          &lt;version&gt;3.0.4&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  <p>Encrypted the password with:</p>
  <pre><code>mvn jasypt:encrypt-value -Djasypt.encryptor.password=javatechie -Djasypt.plugin.value=Password
  </code></pre>
  <p>Created an <code>encrypted.properties</code> and put the encrypted password inside:</p>
  <pre><code>secret.property=ENC(nrmZtkF7T0kjG/VodDvBw93Ct8EgjCAaskygdq8PHapYFnlX6WsTwZZOxWInq+i)
  </code></pre>
  <p>Annotated my Main Class:</p>
  <pre><code>@SpringBootApplication
  @EnableEncryptableProperties
  @PropertySource(name = &quot;EncryptedProperties&quot;, value = &quot;classpath:encrypted.properties&quot;)
  public class Main {
      public static void main(String[] args) {
          SpringApplication.run(Main.class, args);
      }
  }
  </code></pre>
  <p>In another class I try to load the decrypted value:</p>
  <pre><code>@Component
  public class MyOtherClass {
      private static final Logger LOGGER = LoggerFactory.getLogger(MyOtherClass.class);
  
      @Value(&quot;${secret.property}&quot;)
      String secret;
  
      public MyOtherClass() {
          LOGGER.info(&quot;PW: &quot; + secret);
      }
  }
  </code></pre>
  <p>But I just get:</p>
  <pre><code>PW: null
  </code></pre>
  <hr />
  <p>When I change the value into something nonexistent:</p>
  <pre><code>@Value(&quot;${abc.def}&quot;)
  String secret;
  </code></pre>
  <p>I get the expected error:</p>
  <blockquote>
  <p>java.lang.IllegalArgumentException: Could not resolve placeholder 'abc.def' in value &quot;${abc.def}&quot;</p>
  </blockquote>
  <p>So it seems to find my actual value <code>secret.property</code>, but why it's <code>null</code>?</p>