Skip to content

Commit a6c3d9e

Browse files
committed
start
1 parent 0950945 commit a6c3d9e

3 files changed

Lines changed: 38 additions & 1 deletion

File tree

pom.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@
7171
<artifactId>bootstrap</artifactId>
7272
<version>${webjars-bootstrap.version}</version>
7373
</dependency>
74+
<dependency>
75+
<groupId>org.jscience</groupId>
76+
<artifactId>jscience</artifactId>
77+
<version>4.3.1</version>
78+
</dependency>
7479
<dependency>
7580
<groupId>org.webjars</groupId>
7681
<artifactId>webjars-locator</artifactId>
@@ -85,6 +90,16 @@
8590

8691
<build>
8792
<plugins>
93+
<plugin>
94+
<artifactId>maven-assembly-plugin</artifactId>
95+
<version>3.0.0</version>
96+
<configuration>
97+
<descriptorRefs>
98+
<descriptorRef>jar-with-dependencies</descriptorRef>
99+
</descriptorRefs>
100+
<finalName>helloworld</finalName>
101+
</configuration>
102+
</plugin>
88103
<plugin>
89104
<groupId>org.springframework.boot</groupId>
90105
<artifactId>spring-boot-maven-plugin</artifactId>

src/main/java/com/example/Main.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
22
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -33,11 +33,25 @@
3333
import java.sql.Statement;
3434
import java.util.ArrayList;
3535
import java.util.Map;
36+
37+
import static javax.measure.unit.SI.KILOGRAM;
38+
import javax.measure.quantity.Mass;
39+
import org.jscience.physics.model.RelativisticModel;
40+
import org.jscience.physics.amount.Amount;
41+
/*
3642
3743
@Controller
3844
@SpringBootApplication
3945
public class Main {
4046
47+
@RequestMapping("/hello")
48+
String hello(Map<String, Object> model) {
49+
RelativisticModel.select();
50+
Amount<Mass> m = Amount.valueOf("12 GeV").to(KILOGRAM);
51+
model.put("science", "E=mc^2: 12 GeV = " + m.toString());
52+
return "hello";
53+
}
54+
4155
@Value("${spring.datasource.url}")
4256
private String dbUrl;
4357

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<!DOCTYPE html>
2+
<html xmlns:th="http://www.thymeleaf.org" th:replace="~{fragments/layout :: layout (~{::body},'hello')}">
3+
<body>
4+
<div class="container">
5+
<p th:text="${science}"/>
6+
</div>
7+
</body>
8+
</html>

0 commit comments

Comments
 (0)