Class HelloResource

All Implemented Interfaces:
BasicUniversalConfig, DefaultConfig, DefaultHtmlConfig

public class HelloResource extends BasicRestResource
Tiny REST resource that demonstrates Spring @Autowired injection into a Juneau @Rest servlet under a Spring Boot deployment. Mirrors the legacy HelloWorldResource demo.

The HelloMessageProvider bean is wired by Spring; the GET /hello/* endpoint surfaces its message. Resolution of the HelloMessageProvider bean works because the parent router extends BasicSpringRestServletGroup (i.e. SpringRestServlet), which lets child resources be Spring beans.

See Also:
  • Constructor Details

    • HelloResource

      @Autowired public HelloResource(HelloMessageProvider messageProvider)
      Constructor.
      Parameters:
      messageProvider - The Spring-injected message provider bean.
  • Method Details

    • sayHello

      public String sayHello()
      GET /hello/* — returns the message provided by the injected Spring bean.
      Returns:
      The injected message.