Reputation: 339
I have a spring boot app (2.0.1) with embedded Tomcat that has been assembled into an executable jar via mvn clean package springboot:repackage. The application runs perfectly.
We have a security requirement that states that the passwords used must be encrypted in the property files. They are ( with jasypt). I am using @ConfigurationProperties to inject them into classes.
As part of a QA test, the testers need to see the encrypted properties.
My question is, when I open the jar file, I can't find the application.properties files. Are they not loaded in the jar? Preinjected at compile time based on the environment?
pom.xml
<groupId>com.jebrick.rim</groupId>
<artifactId>regulusConnector</artifactId>
<version>1.0-QA-RELEASE</version>
<packaging>jar</packaging>
<name>regulusConnector</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<cxf.version>3.2.5</cxf.version>
<spring-cloud.version>Dalston.SR1</spring-cloud.version>
<tomcat.version>8.5.34</tomcat.version>
<mainClass>com.jebrick.rim.App</mainClass>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
</parent>
<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>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<!--<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>-->
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<version>2.0.1.RELEASE</version>
<optional>true</optional>
</dependency>
more dependencies
<build>
<resources>
<resource>
<directory>resources</directory>
<targetPath>src/main/java/resources</targetPath>
<includes>
<include>*.properties</include>
</includes>
</resource>
</resources>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.jebrick.rim.App</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<!-- Force alphabetical order to have a reproducible build -->
<runOrder>alphabetical</runOrder>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
Upvotes: 1
Views: 3531
Reputation: 36103
The application.properties file is in the JAR file in:
BOOT-INF\classes\application.properties
Upvotes: 3