Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
|
7 years ago | |
---|---|---|
.. | ||
src | 7 years ago | |
README.md | 7 years ago | |
pom.xml | 7 years ago |
依赖 spring-boot-demo-helloworld
SpringBootDemoHelloworldApplication.java
@RestController
@SpringBootApplication
@Configuration
public class SpringBootDemoHelloworldApplication {
@Value("${spring.boot.demo.helloworld.data.version}")
private String version;
public static void main(String[] args) {
SpringApplication.run(SpringBootDemoHelloworldApplication.class, args);
}
@GetMapping("/hello")
public Map sayHello(@Value("${author}") String author, @Value("${exclusions}") String exclusions, @Value("${connectionProperties}") String connectionProperties) {
Map<String, Object> result = Maps.newHashMap();
result.put("ret", true);
result.put("msg", StrUtil.format("hello,world,{}", author));
Map<String, Object> data = Maps.newHashMap();
data.put("version", version);
data.put("exclusions", exclusions.split(","));
Map<String, Object> connectionProperty = Maps.newHashMap();
for (String connection : connectionProperties.split(";")) {
String[] conn = connection.split("=");
connectionProperty.put(conn[0], conn[1]);
}
data.put("connectionProperties", connectionProperty);
result.put("data", data);
return result;
}
}
application.yml
server:
port: 8080
context-path: /demo
spring:
boot:
demo:
helloworld:
data:
version: 1.0.0
author: xkcoding
exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
一个用来深度学习并实战 spring boot 的项目,目前总共包含 66 个集成demo,已经完成 55 个。
Java SVG CSS JavaScript SQL other