简体   繁体   中英

Play-Rest api with java - object is not a member of package

I have a problem, I cant load my web because this error appears:

object UsersServices is not a member of package controllers

I use rest api :

# Routes
# This file defines all application routes (Higher priority routes first)
# ~~~~

# Home page
GET     /                           controllers.Assets.at(path="/public/view",file="index.html")

# Map static resources from the /public folder to the /assets URL path
GET  /public/*file        controllers.Assets.at(path="/public", file)


GET /api/users            controllers.UsersServices.getUsers()

and the function in java is very basic:

public static Result getUsers(){
        return ok(Json.toJson(Test);
    }

I rely doesn't know how to fix it.

From the info you have supplied, it would appear you need to have something like:

package controllers;
imports...

public class UsersServices extends Controller {

  public Result getUsers() {
  ...

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