简体   繁体   中英

How to read properties value from interface in java

I would like to read testvalue from properties file in java, can someone please help Following is my code

package com.test;

import java.util.Map;

import com.amazonaws.services.lambda.invoke.LambdaFunction;

public interface LambdaPDFService {
    @LambdaFunction(functionName="**testValue**")
    Map<String, String> setResponse(LambdaPdfRequest input);
}


I have tried below annotation, and e.tc but it's not working

@PropertySources(@PropertySource("classpath:application.properties"))

You can't read in an interface.

You can read in a concrete class annotated as a @Service (or @Component). Assuming application.properties includes lambda.function.name=foo

@Service
public class LambdaPDFServiceImpl implements LambdaPDFService {
    @LambdaFunction(functionName="${lambda.function.name}")
    Map<String, String> setResponse(LambdaPdfRequest input) {
        // TODO
    }

}

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