webjars and some changes

This commit is contained in:
manalejandro 2018-07-12 22:38:36 +02:00
parent b260838e0c
commit ce29f8beed
9 changed files with 108 additions and 2 deletions

15
pom.xml
View File

@ -26,6 +26,10 @@
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
@ -49,6 +53,17 @@
<type>pom</type>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>3.3.7-1</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>3.1.1-1</version>
</dependency>
</dependencies>
<build>

View File

@ -0,0 +1,16 @@
package com.manalejandro.arjion;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
@EnableWebMvc
public class WebConfig implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/webjars/**").addResourceLocations("/webjars/");
}
}

View File

@ -1,8 +1,14 @@
package com.manalejandro.arjion.controllers;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class MainController {
@RequestMapping(path = "/")
public String indexPage(final Model model) {
return "index";
}
}

View File

@ -1,12 +1,32 @@
package com.manalejandro.arjion.model;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Mapping;
import org.springframework.data.elasticsearch.annotations.Setting;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
@Document(indexName = "#{@indexName}", type = "#{@documentType}")
@Setting(settingPath = "/elasticsearch/settings.json")
@Mapping(mappingPath = "/elasticsearch/mapping.json")
public class Documento {
@Id
public Integer id;
@JsonCreator
public Documento(@JsonProperty("id") Integer id) {
super();
this.id = id;
}
@JsonProperty("id")
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
}

View File

@ -1,9 +1,13 @@
server.servlet.context-path=/arjion
server.port=8080
elasticsearch.clustername=development
elasticsearch.clustername=elasticsearch
elasticsearch.host=localhost
elasticsearch.port=9300
elasticsearch.nodename=arjion
arjion.indexName=documentos
arjion.documentType=documento
spring.main.allow-bean-definition-overriding=true
spring.thymeleaf.enabled=true
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
spring.thymeleaf.cache=false

View File

@ -0,0 +1,16 @@
{
"documento": {
"properties": {
"@timestamp": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
},
"@version": {
"type": "keyword"
},
"id": {
"type": "long"
}
}
}
}

View File

@ -0,0 +1,6 @@
{
"index": {
"number_of_shards": "5",
"number_of_replicas": "1"
}
}

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Error</title>
</head>
<body>
</body>
</html>

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Arjion</title>
<link rel="stylesheet" href="webjars/bootstrap/3.3.7-1/css/bootstrap.min.css">
<script src="webjars/jquery/3.1.1-1/jquery.min.js"></script>
<script src="webjars/bootstrap/3.3.7-1/js/bootstrap.min.js"></script>
</head>
<body>
</body>
</html>