reform dir structure
This commit is contained in:
46
app/build.gradle.kts
Normal file
46
app/build.gradle.kts
Normal file
@@ -0,0 +1,46 @@
|
||||
plugins {
|
||||
id("elex-springboot")
|
||||
id("org.springframework.boot") version "2.4.2"
|
||||
id("io.spring.dependency-management") version "1.0.11.RELEASE"
|
||||
id("org.asciidoctor.convert") version "1.5.8"
|
||||
}
|
||||
|
||||
group = "com.elex-project"
|
||||
version = "0.0.1-SNAPSHOT"
|
||||
description = ""
|
||||
|
||||
ext {
|
||||
set("snippetsDir", file("build/generated-snippets"))
|
||||
}
|
||||
springBoot{
|
||||
buildInfo()
|
||||
}
|
||||
|
||||
tasks.test {
|
||||
outputs.dir(ext.get("snippetsDir")!!)
|
||||
}
|
||||
tasks.asciidoctor {
|
||||
inputs.dir(ext.get("snippetsDir")!!)
|
||||
setDependsOn(mutableListOf("test"))
|
||||
}
|
||||
|
||||
dependencies {
|
||||
//implementation("org.springframework.boot:spring-boot-starter-data-jpa")
|
||||
implementation("org.springframework.boot:spring-boot-starter-mustache")
|
||||
//implementation("org.springframework.boot:spring-boot-starter-security")
|
||||
implementation("org.springframework.boot:spring-boot-starter-web")
|
||||
|
||||
//implementation ("com.fasterxml.jackson.dataformat:jackson-dataformat-xml")
|
||||
//implementation ("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
|
||||
|
||||
compileOnly("org.projectlombok:lombok")
|
||||
developmentOnly("org.springframework.boot:spring-boot-devtools")
|
||||
//runtimeOnly("org.mariadb.jdbc:mariadb-java-client")
|
||||
|
||||
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
|
||||
annotationProcessor("org.projectlombok:lombok")
|
||||
|
||||
testImplementation("org.springframework.boot:spring-boot-starter-test")
|
||||
testImplementation("org.springframework.restdocs:spring-restdocs-mockmvc")
|
||||
//testImplementation("org.springframework.security:spring-security-test")
|
||||
}
|
||||
15
app/src/main/java/com/elex_project/freesia/Application.java
Normal file
15
app/src/main/java/com/elex_project/freesia/Application.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package com.elex_project.freesia;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@Slf4j
|
||||
@SpringBootApplication
|
||||
public final class Application {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Application.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
39
app/src/main/java/com/elex_project/freesia/Config.java
Normal file
39
app/src/main/java/com/elex_project/freesia/Config.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package com.elex_project.freesia;
|
||||
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.mustache.MustacheEnvironmentCollector;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
@Configuration
|
||||
public final class Config {
|
||||
@Value("elex.view.template.default")
|
||||
private String templateDefaultValue;
|
||||
|
||||
@Bean
|
||||
public Mustache.Compiler mustacheCompiler(
|
||||
Mustache.TemplateLoader templateLoader,
|
||||
Environment environment) {
|
||||
|
||||
MustacheEnvironmentCollector collector
|
||||
= new MustacheEnvironmentCollector();
|
||||
collector.setEnvironment(environment);
|
||||
|
||||
return Mustache.compiler()
|
||||
.defaultValue(templateDefaultValue)
|
||||
.withLoader(templateLoader)
|
||||
.withCollector(collector);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public RestTemplate restTemplate() {
|
||||
return new RestTemplate();
|
||||
}
|
||||
/*@Bean
|
||||
public HttpTraceRepository httpTraceRepository() {
|
||||
return new InMemoryHttpTraceRepository();
|
||||
}*/
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.elex_project.freesia.controller;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class Home {
|
||||
@GetMapping(value = "/")
|
||||
public ModelAndView home() {
|
||||
final Map<String, Object> map = new HashMap<>();
|
||||
return new ModelAndView("home", map);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
package com.elex_project.freesia.controller;
|
||||
@@ -0,0 +1 @@
|
||||
package com.elex_project.freesia.model;
|
||||
@@ -0,0 +1 @@
|
||||
package com.elex_project.freesia;
|
||||
@@ -0,0 +1 @@
|
||||
package com.elex_project.freesia.view;
|
||||
39
app/src/main/resources/application.yaml
Normal file
39
app/src/main/resources/application.yaml
Normal file
@@ -0,0 +1,39 @@
|
||||
elex:
|
||||
view:
|
||||
template:
|
||||
default: "[!UNDEFINED]"
|
||||
server:
|
||||
port: 8080
|
||||
spring:
|
||||
application:
|
||||
name: Freesia
|
||||
datasource:
|
||||
url: jdbc:mariadb://localhost:3306/freesia
|
||||
driver-class-name: org.mariadb.jdbc.Driver
|
||||
username: elex
|
||||
password: test
|
||||
jpa:
|
||||
open-in-view: false
|
||||
generate-ddl: true
|
||||
show-sql: true
|
||||
hibernate:
|
||||
ddl-auto: none
|
||||
security:
|
||||
user:
|
||||
name: elex
|
||||
password: test
|
||||
logging:
|
||||
path: ${user.home}/logs/freesia
|
||||
level:
|
||||
root: debug
|
||||
|
||||
---
|
||||
|
||||
spring:
|
||||
config:
|
||||
active:
|
||||
on-profile: production
|
||||
logging:
|
||||
path: /var/log/freesia
|
||||
level:
|
||||
root: info
|
||||
0
app/src/main/resources/banner.txt
Normal file
0
app/src/main/resources/banner.txt
Normal file
25
app/src/main/resources/logback-spring.xml
Normal file
25
app/src/main/resources/logback-spring.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2021. Elex co.,ltd. All rights reserved.
|
||||
~ developed by <developer@elex-project.com>
|
||||
~
|
||||
-->
|
||||
|
||||
<configuration>
|
||||
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
|
||||
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
|
||||
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<logger name="com.elex_project.freesia" level="debug" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
<root level="info">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</root>
|
||||
|
||||
</configuration>
|
||||
1
app/src/main/resources/templates/fragments/a.mustache
Normal file
1
app/src/main/resources/templates/fragments/a.mustache
Normal file
@@ -0,0 +1 @@
|
||||
<p>Haha</p>
|
||||
9
app/src/main/resources/templates/home.mustache
Normal file
9
app/src/main/resources/templates/home.mustache
Normal file
@@ -0,0 +1,9 @@
|
||||
<html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>Hello</p>
|
||||
{{>fragments/a}}
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.elex_project.freesia;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class FreesiaApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user