1818
1919import com .zaxxer .hikari .HikariConfig ;
2020import com .zaxxer .hikari .HikariDataSource ;
21+ import org .jscience .physics .amount .Amount ;
22+ import org .jscience .physics .model .RelativisticModel ;
2123import org .springframework .beans .factory .annotation .Autowired ;
2224import org .springframework .beans .factory .annotation .Value ;
2325import org .springframework .boot .SpringApplication ;
2628import org .springframework .stereotype .Controller ;
2729import org .springframework .web .bind .annotation .RequestMapping ;
2830
31+ import javax .measure .quantity .Mass ;
2932import javax .sql .DataSource ;
3033import java .sql .Connection ;
3134import java .sql .ResultSet ;
3437import java .util .ArrayList ;
3538import java .util .Map ;
3639
40+ import static javax .measure .unit .SI .KILOGRAM ;
41+
3742@ Controller
3843@ SpringBootApplication
3944public class MainController {
@@ -53,6 +58,14 @@ String index() {
5358 return "index" ;
5459 }
5560
61+ @ RequestMapping ("/hello" )
62+ String hello (Map <String , Object > model ) {
63+ RelativisticModel .select ();
64+ Amount <Mass > m = Amount .valueOf ("12 GeV" ).to (KILOGRAM );
65+ model .put ("science" , "E=mc^2: 12 GeV = " + m .toString ());
66+ return "hello" ;
67+ }
68+
5669 @ RequestMapping ("/db" )
5770 String db (Map <String , Object > model ) {
5871 try (Connection connection = dataSource .getConnection ()) {
0 commit comments