File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed
src/main/java/com/example/demo Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ package com .example .demo ;
2+
3+ import java .util .HashMap ;
4+ import java .util .Map ;
5+ import java .util .UUID ;
6+
7+ import org .springframework .boot .SpringApplication ;
8+ import org .springframework .boot .autoconfigure .SpringBootApplication ;
9+ import org .springframework .boot .context .properties .ConfigurationProperties ;
10+ import org .springframework .stereotype .Component ;
11+ import org .springframework .stereotype .Controller ;
12+ import org .springframework .web .bind .annotation .GetMapping ;
13+ import org .springframework .web .bind .annotation .ResponseBody ;
14+
15+ @ SpringBootApplication
16+ @ Controller
17+ public class DemoApplication {
18+
19+ @ GetMapping ("/resource" )
20+ @ ResponseBody
21+ public Map <String , Object > home () {
22+ Map <String , Object > model = new HashMap <String , Object >();
23+ model .put ("id" , UUID .randomUUID ().toString ());
24+ model .put ("content" , "Hello World" );
25+ return model ;
26+ }
27+
28+ @ GetMapping (value = "/{path:[^\\ .]*}" )
29+ public String redirect () {
30+ return "forward:/" ;
31+ }
32+
33+ public static void main (String [] args ) {
34+ SpringApplication .run (DemoApplication .class , args );
35+ }
36+ }
37+
38+ @ Component
39+ @ ConfigurationProperties ("demo" )
40+ class DemoProperties {
41+ private String value ;
42+
43+ public String getValue () {
44+ return value ;
45+ }
46+
47+ public void setValue (String value ) {
48+ this .value = value ;
49+ }
50+ }
You can’t perform that action at this time.
0 commit comments