I'm using Play framework to make website.
But had problem when I tried to read properties file.
I searched and try with [Play.application().resourceAsStream("test.properties")]
but have error [Play.application().resourceAsStream("test.properties")]
.
but had error:
[the method aplication(Aplication) in the type Play is not applicable for the arguments()]
what should I do?
You need to inject Configuration
object:
Scala
class HomeController @Inject()(conf: Configuration) extends Controller{
def post() = Action{
val testProp = conf.getString("test.properties")
...
Java
public class HomeController extends Controller{
@Inject
private Configuration configuration;
public Result post(){
final String testProp = configuration.getString("test.properties")
...
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.