0

I'm writing a Java library, and I found that GWT has ClientBundle interface/class that can use like this:

public interface DefaultResources extends ClientBundle
{
    @Source("source/resource.rs")
    TextResource getTextResource();
}

How can I achieve that without using GWT?

Many thanks!

CasperPas
  • 57
  • 2
  • 5

1 Answers1

1

You can use Spring DI to achieve this.

    @Value("classpath:source/resource.rs")
    Resource myResource;
retroq
  • 572
  • 2
  • 7
  • can I use that with text file and String myStrResource; – CasperPas Nov 29 '14 at 06:31
  • 1
    You can use it with text file and Resource interface which has `getInputStream` method. If you want to get resource as String, you can make use of [this answer](http://stackoverflow.com/a/309448/2221168) – retroq Nov 29 '14 at 08:22