Skip to content

Commit

Permalink
release v1.0.1 (#22)
Browse files Browse the repository at this point in the history
* set correct version

* add current version to footer
  • Loading branch information
slabiak authored Dec 22, 2020
1 parent f798097 commit 82ab751
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 4 deletions.
23 changes: 21 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
Expand All @@ -10,7 +10,7 @@
</parent>
<groupId>com.example.slabiak</groupId>
<artifactId>appointmentscheduler</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>1.0.1</version>
<name>appointmentscheduler</name>
<description>Demo project for Spring Boot</description>

Expand All @@ -35,6 +35,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

<dependency>
<groupId>mysql</groupId>
Expand Down Expand Up @@ -163,6 +167,21 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build-info</goal>
</goals>
<configuration>
<additionalProperties>
<encoding.source>UTF-8</encoding.source>
<encoding.reporting>UTF-8</encoding.reporting>
<java.source>${maven.compiler.source}</java.source>
<java.target>${maven.compiler.target}</java.target>
</additionalProperties>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.example.slabiak.appointmentscheduler.config;

import org.springframework.boot.info.BuildProperties;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Component
public class VersionInterceptor extends HandlerInterceptorAdapter {

private BuildProperties buildProperties;

public VersionInterceptor(BuildProperties buildProperties) {
this.buildProperties = buildProperties;
}

@Override
public void postHandle(final HttpServletRequest request, final HttpServletResponse response, final Object handler,
final ModelAndView modelAndView) throws Exception {

if (modelAndView != null) {
modelAndView.getModelMap().addAttribute("currentVersion", buildProperties.getVersion());
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.example.slabiak.appointmentscheduler.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

@Autowired
private VersionInterceptor versionInterceptor;

@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(versionInterceptor);
}
}
3 changes: 3 additions & 0 deletions src/main/resources/templates/fragments/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@
<!-- Page Content -->
<div class="container">
<th:block th:include="${content}"/>
<div class="row align-items-center justify-content-center" style="margin-top: 50px">
<p>AppointmentScheduler, v<span th:text="${currentVersion}">1.0</span></p>
</div>
</div>

<script th:inline="javascript">
Expand Down
3 changes: 1 addition & 2 deletions src/main/resources/templates/home.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" th:replace="~{fragments/layout :: layout (~{::body},'home','Home')}"
xmlns:sec="http://www.w3.org/1999/xhtml">
>

<body>
<div class="row mt-3">
Expand All @@ -14,7 +14,6 @@

</div>
</div>
</div>

<script th:inline="javascript">
$(function () {
Expand Down

0 comments on commit 82ab751

Please sign in to comment.