这里分类和汇总了欣宸的全部原创(含配套源码):https://github.com/zq2599/blog_demos
mvn quarkus:dev
package com.bolingcavalry;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.time.LocalDateTime;
@Path("/actions")
public class HobbyResource {
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
return "Hello RESTEasy " + LocalDateTime.now();
}
}
package com.bolingcavalry;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.time.LocalDateTime;
@Path("/actions")
public class HobbyResource {
@ConfigProperty(name = "greeting.message")
String message;
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
return "Hello RESTEasy " + LocalDateTime.now() + " " + message;
}
}
# 这是一个自定义属性
greeting.message=message from configuration
mvn quarkus:dev -DdebugHost=0.0.0.0 -Ddebug=5006