Skip to content

Commit ae34c4a

Browse files
committed
Draft 1
1. initial project setup.
0 parents  commit ae34c4a

File tree

6 files changed

+205
-0
lines changed

6 files changed

+205
-0
lines changed

.gitignore

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/target/
2+
/bin/
3+
.classpath
4+
.project
5+
.settings
6+
.factorypath
7+
HELP.md
8+
.mvn/wrapper/**
9+
mvnw
10+
mvnw.*
11+
12+
# Compiled class file
13+
*.class
14+
15+
# Log file
16+
*.log
17+
*.log.*
18+
19+
# BlueJ files
20+
*.ctxt
21+
22+
# Mobile Tools for Java (J2ME)
23+
.mtj.tmp/
24+
25+
# Package Files #
26+
*.jar
27+
*.war
28+
*.nar
29+
*.ear
30+
*.zip
31+
*.tar.gz
32+
*.rar
33+
34+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
35+
hs_err_pid*

pom.xml

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<groupId>org.springframework.boot</groupId>
7+
<artifactId>spring-boot-starter-parent</artifactId>
8+
<version>3.0.5</version>
9+
<relativePath/> <!-- lookup parent from repository -->
10+
</parent>
11+
<groupId>com.streamlined</groupId>
12+
<artifactId>Library</artifactId>
13+
<version>0.0.1-SNAPSHOT</version>
14+
<name>Library</name>
15+
<description>Training project modelling library</description>
16+
<properties>
17+
<java.version>20</java.version>
18+
</properties>
19+
<dependencies>
20+
<dependency>
21+
<groupId>org.springframework.boot</groupId>
22+
<artifactId>spring-boot-starter</artifactId>
23+
<exclusions>
24+
<exclusion>
25+
<groupId>org.springframework.boot</groupId>
26+
<artifactId>spring-boot-starter-logging</artifactId>
27+
</exclusion>
28+
</exclusions>
29+
</dependency>
30+
<dependency>
31+
<groupId>org.springframework.boot</groupId>
32+
<artifactId>spring-boot-starter-log4j2</artifactId>
33+
</dependency>
34+
<dependency>
35+
<groupId>org.springframework.boot</groupId>
36+
<artifactId>spring-boot-starter-security</artifactId>
37+
</dependency>
38+
<dependency>
39+
<groupId>org.springframework.boot</groupId>
40+
<artifactId>spring-boot-starter-thymeleaf</artifactId>
41+
</dependency>
42+
<dependency>
43+
<groupId>org.springframework.boot</groupId>
44+
<artifactId>spring-boot-starter-validation</artifactId>
45+
</dependency>
46+
<dependency>
47+
<groupId>org.springframework.boot</groupId>
48+
<artifactId>spring-boot-starter-web</artifactId>
49+
</dependency>
50+
<dependency>
51+
<groupId>org.thymeleaf.extras</groupId>
52+
<artifactId>thymeleaf-extras-springsecurity6</artifactId>
53+
</dependency>
54+
<dependency>
55+
<groupId>org.springframework.boot</groupId>
56+
<artifactId>spring-boot-devtools</artifactId>
57+
<scope>runtime</scope>
58+
<optional>true</optional>
59+
</dependency>
60+
<dependency>
61+
<groupId>org.projectlombok</groupId>
62+
<artifactId>lombok</artifactId>
63+
<optional>true</optional>
64+
</dependency>
65+
<dependency>
66+
<groupId>org.springframework.boot</groupId>
67+
<artifactId>spring-boot-starter-test</artifactId>
68+
<scope>test</scope>
69+
</dependency>
70+
<dependency>
71+
<groupId>org.springframework.security</groupId>
72+
<artifactId>spring-security-test</artifactId>
73+
<scope>test</scope>
74+
</dependency>
75+
</dependencies>
76+
77+
<build>
78+
<plugins>
79+
<plugin>
80+
<groupId>org.springframework.boot</groupId>
81+
<artifactId>spring-boot-maven-plugin</artifactId>
82+
<configuration>
83+
<excludes>
84+
<exclude>
85+
<groupId>org.projectlombok</groupId>
86+
<artifactId>lombok</artifactId>
87+
</exclude>
88+
</excludes>
89+
</configuration>
90+
</plugin>
91+
</plugins>
92+
</build>
93+
94+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package com.streamlined.library;
2+
3+
import java.util.Arrays;
4+
import java.util.Date;
5+
6+
import org.springframework.beans.factory.annotation.Autowired;
7+
import org.springframework.boot.CommandLineRunner;
8+
import org.springframework.boot.SpringApplication;
9+
import org.springframework.boot.autoconfigure.SpringBootApplication;
10+
import org.springframework.context.ApplicationContext;
11+
12+
import lombok.extern.log4j.Log4j2;
13+
14+
@SpringBootApplication
15+
@Log4j2
16+
public class LibraryApplication implements CommandLineRunner {
17+
18+
@Autowired
19+
private ApplicationContext context;
20+
21+
public static void main(String[] args) {
22+
SpringApplication.run(LibraryApplication.class, args);
23+
}
24+
25+
@Override
26+
public void run(String... args) throws Exception {
27+
Arrays.asList(context.getBeanDefinitionNames()).forEach(log::info);
28+
log.info("Total number of bean definitions {}", context.getBeanDefinitionCount());
29+
log.info("Logger implementation class {}", log.getClass().getName());
30+
log.info("Application startup date/time {}", new Date(context.getStartupDate()));
31+
}
32+
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
server.port=8090

src/main/resources/log4j2.xml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Configuration status="WARN" monitorInterval="60">
3+
<Properties>
4+
<Property name="LOG_PATTERN">[%-5p] %d{yyyy-MM-dd HH:mm:ss.SSSZ} %m%n</Property>
5+
<Property name="APP_LOG_ROOT">logs</Property>
6+
</Properties>
7+
8+
<Appenders>
9+
<Console name="Console-Appender" target="SYSTEM_OUT" follow="true">
10+
<PatternLayout pattern="${LOG_PATTERN}" />
11+
</Console>
12+
<RollingFile name="File-Appender"
13+
fileName="${APP_LOG_ROOT}/application.log"
14+
filePattern="${APP_LOG_ROOT}/application.log.%d{yyyy-MM-dd}-%i.gz">
15+
<PatternLayout pattern="${LOG_PATTERN}" />
16+
<Policies>
17+
<SizeBasedTriggeringPolicy size="1 MB" />
18+
</Policies>
19+
<DefaultRolloverStrategy max="5" />
20+
</RollingFile>
21+
</Appenders>
22+
23+
<Loggers>
24+
<Root level="debug">
25+
<AppenderRef ref="Console-Appender" level="debug"/>
26+
<AppenderRef ref="File-Appender" level="error"/>
27+
</Root>
28+
</Loggers>
29+
</Configuration>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.streamlined.library;
2+
3+
import org.junit.jupiter.api.Test;
4+
import org.springframework.boot.test.context.SpringBootTest;
5+
6+
@SpringBootTest
7+
class LibraryApplicationTests {
8+
9+
@Test
10+
void contextLoads() {
11+
}
12+
13+
}

0 commit comments

Comments
 (0)