Slide 17
Slide 17 text
@2022 IBM Corporation
IBM Automation Software
Java EEアプリからMicroProfileのAPIを使⽤する例
16
例) Servletの中からConfig APIを使⽤
@ApplicationScoped
@WebServlet("/config")
public class ConfitTestServlet extends HttpServlet {
@Inject
@ConfigProperty(name = "PWD")
private String pwd;
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
response.setContentType("text/plain; charset=utf-8");
response.getWriter().append("Currend working directory: ").append(pwd);
}