Browse Source

Implement BookStorePages class, primarily for Thymeleaf

Signed-off-by: Pekka Helenius <fincer89@hotmail.com>
v0.0.3-alpha
Pekka Helenius 4 years ago
parent
commit
e11cfc4808
1 changed files with 81 additions and 0 deletions
  1. +81
    -0
      bookstore/src/main/java/com/fjordtek/bookstore/service/session/BookStorePages.java

+ 81
- 0
bookstore/src/main/java/com/fjordtek/bookstore/service/session/BookStorePages.java View File

@ -0,0 +1,81 @@
//Pekka Helenius <fincer89@hotmail.com>, Fjordtek 2020
package com.fjordtek.bookstore.service.session;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
/**
*
* This class gets Spring Environment key property values from
* Spring property sources and inserts them into publicly
* accessible class attributes. Attributes are related to
* application web pages.
* <p>
* The attribute values of this class are primarily used
* in Thymeleaf HTML template files.
*
* @author Pekka Helenius
*/
@Component("Pages")
public class BookStorePages {
@Autowired
private Environment env;
public String
INDEX,
LIST,
ADD,
DELETE,
EDIT,
LOGIN,
LOGOUT,
ERROR,
AUTHERROR,
APIREF,
JSON,
JSONBOOK,
JSONLIST,
H2CONSOLE,
REST,
RESTAUTHORS,
RESTBOOKS,
RESTCATEGORIES
;
@PostConstruct
private void constructPages() {
this.INDEX = env.getProperty("page.url.index");
this.LIST = env.getProperty("page.url.list");
this.ADD = env.getProperty("page.url.add");
this.DELETE = env.getProperty("page.url.delete");
this.EDIT = env.getProperty("page.url.edit");
this.LOGIN = env.getProperty("page.url.login");
this.LOGOUT = env.getProperty("page.url.logout");
this.ERROR = env.getProperty("page.url.error");
this.AUTHERROR = env.getProperty("page.url.autherror");
this.APIREF = env.getProperty("page.url.apiref");
this.JSON = env.getProperty("page.url.json");
this.JSONBOOK = env.getProperty("page.url.json.book");
this.JSONLIST = env.getProperty("page.url.json.list");
this.H2CONSOLE = env.getProperty("spring.h2.console.path");
this.REST = env.getProperty("spring.data.rest.base-path");
this.RESTAUTHORS = env.getProperty("page.url.restapi.authors");
this.RESTBOOKS = env.getProperty("page.url.restapi.books");
this.RESTCATEGORIES = env.getProperty("page.url.restapi.categories");
}
}

Loading…
Cancel
Save