简体   繁体   中英

Reading @Path from properties file

The rest application in build using spring and jersy. I need a rest application that can read the value of @path annotation from the properties file.
PFB the code sample:-

@Controller
@Path("report")
public  class CommonService extends BaseService
{

    @Path("specificGet")
    @GET
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    public Response getReport ()
    {
    -----------
    -----------
     }

I want the value that is now "specificGet" to be readable from a .properties file. For example if i have the below entry in properties file:-

path.getwithoutparam=thispathforGet

I want to refer to this property for @path annotation Please comments/suggestions will be very helpful.

I might get some downvotes :)) but I'm pretty sure there is no out-of-the-box support for property placeholders for @Path annotations.

I guess you would have to build your own annotation processor in this case, that plugs into Spring property handling system.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM