Skip to content

Commit 0d20e99

Browse files
authored
Merge pull request dsyer#18 from chrisinmtown/restore-java-file-from-history
Restore DemoApplication.java from history
2 parents 8919a4f + 5a96b89 commit 0d20e99

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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+
}

0 commit comments

Comments
 (0)