Skip to content

Commit

Permalink
add property from configmap
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis van Loon committed Oct 26, 2022
1 parent 464249c commit 6ad4986
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
14 changes: 13 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.4</version>
<version>2.7.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.dvl</groupId>
Expand All @@ -29,6 +29,18 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-context</artifactId>
<version>3.1.4</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-kubernetes-commons</artifactId>
<version>2.1.4</version>
</dependency>

<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/com/dvl/adobesign/config/AdobeSignConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.dvl.adobesign.config;

import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConfigurationProperties(prefix = "bean")
@Getter
@Setter
public class AdobeSignConfig {

private String message = "Default message from backend is: %s <br/> Services : %s";

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.dvl.adobesign.controller;

import com.dvl.adobesign.config.AdobeSignConfig;
import com.dvl.adobesign.model.Contract;
import com.dvl.adobesign.service.ContractService;
import org.springframework.core.io.InputStreamResource;
Expand All @@ -22,13 +23,17 @@ public class ContactController {

private final ContractService contractService;

public ContactController(ContractService contractService) {
private final AdobeSignConfig adobeSignConfig;

public ContactController(ContractService contractService, AdobeSignConfig adobeSignConfig) {
this.contractService = contractService;
this.adobeSignConfig = adobeSignConfig;
}

@GetMapping(value = "/")
public String index(Model model) {
model.addAttribute("contracts", contractService.getContracts());
model.addAttribute("message", adobeSignConfig.getMessage());
return "index";
}

Expand Down
1 change: 1 addition & 0 deletions src/main/resources/templates/index.ftlh
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
</#foreach>
</table>
</div>
<div>Message from the config: ${message}</div>
</body>
</html>

0 comments on commit 6ad4986

Please sign in to comment.