title: how can I override application.properties of a jar by its calling spring boot application properties
body: <p>I am consuming a spring boot project (jar) inside another spring boot project using the maven dependency. The jar file has no properties defined in application.properties, I want to fetch the properties of current spring boot project inside the jar file. Is there any way to override the application.properties of jar.</p>
  
  <p><strong>===============Microservice1=====================</strong>:</p>
  
  <pre><code>@SpringBootApplication
  @ComponentScan({"com.jwt.security.*"})
  public class MicroserviceApplication1 {
  
      public static void main(String[] args) throws Exception {
  
          SpringApplication.run(MicroserviceApplication1.class, args);
  
      }
  
      @Bean
      public static PropertySourcesPlaceholderConfigurer propertyConfigInDev() {
          return new PropertySourcesPlaceholderConfigurer();
      }
  }
  </code></pre>
  
  <p><strong>application.properties</strong></p>
  
  <pre><code>jwt.auth.secret: secret
  jwt.auth.token_prefix : Bearer
  jwt.auth.header_string : Authorization
  </code></pre>
  
  <p><strong>UserController</strong></p>
  
  <pre><code>@RestController
  @Slf4j
  public class UserController
  {
  @RequestMapping(value="/jwt")
      public String tokens(){
          log.debug("User controller called : Token()");
          return "successful authentication";
      }
  }
  </code></pre>
  
  <p><strong>pom.xml</strong></p>
  
  <pre><code>...
      &lt;dependency&gt;
          &lt;groupId&gt;com.jwt.security&lt;/groupId&gt;
          &lt;artifactId&gt;securityUtils&lt;/artifactId&gt;
          &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;/dependency&gt;
  ...
  </code></pre>
  
  <p>Now, below is configuration in the jar.</p>
  
  <p><strong>==========securityUtils============</strong></p>
  
  <pre><code>@Slf4j
  @Component
  //@PropertySource("classpath:/application.properties")
  //@ConfigurationProperties(prefix = "jwt")
  class TokenAuthenticationService {
  
      @Value("${jwt.auth.secret}")
      private static String secret;
  
      @Value("${jwt.auth.header_string}")
      private static String headerString;
  
      @Value("${jwt.auth.token_prefix}")
      private static String tokenPrefix;
  
      static void getAuthentication(HttpServletRequest request) {
          String token = request.getHeader(headerString);
          Date referenceTime = new Date();
          if (token != null) {
              final Claims claims = Jwts.parser()
                      .setSigningKey(secret.getBytes())
                      .parseClaimsJws(token.replace(tokenPrefix, ""))
                      .getBody();
  
              if (claims == null) {
                  throw new BadCredentialsException("You are not authoriozed");
              } else {
                  Date expirationTime = claims.getExpiration();
                  if (expirationTime == null || expirationTime.before(referenceTime)) {
                      log.debug("The token is expired");
                      throw new TokenExpiredException("The token is expired");
  
                  }
              }
  
          } else {
              throw new BadCredentialsException("You are not authoriozed");
          }
      }
  }
  </code></pre>
  
  <p>In TokenAuthenticationService I want to get the properties loaded from the calling microservice1</p>
  
  <p>Thanks</p>