I am trying to create a simple spring MVC app in Scala I did define my methods in the controller to bring back html pages based on name from resources folder but it just always brings back just index page and the rest of html pages while trying to access the route it just fails, but same application works fine in Java.
full source code is here:-
Java:- https://github.com/kali786516/SpringConfigServer-client/tree/master/src/main/java/com/example/SpringConfigServerclient
Scala:- https://github.com/kali786516/SpringConfigServer-client/tree/master/src/main/scala/com/ps/spring/mvc/psbankapp
Error in Scala:-
Index html Works Fine:-
but rest of the routes doesn't work in scala
Scala controller:-
package com.ps.spring.mvc.psbankapp.controllers
import org.springframework.beans.factory.annotation.Value
import org.springframework.cloud.context.config.annotation.RefreshScope
import org.springframework.stereotype.Controller
import org.springframework.ui.Model
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.RequestMethod
//@RefreshScope
@Controller
//@ComponentScan(basePackages = Array("com.ps.spring.mvc.psbankapp"))
class AccountController {
@RequestMapping(value = Array("/"))
def showHomePage(): Unit = {
"index"
}
@RequestMapping(value = Array("/new"), method = Array(RequestMethod.GET))
def newAccount(): Unit = {
"newAccount"
}
@RequestMapping(value = Array("/showAccount"))
def showAccount(): Unit = {
"showAccount"
}
}
Java Controller:-
package com.example.SpringConfigServerclient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMethod;
@RefreshScope
@Controller
public class RateController {
@RequestMapping(value = "/index",method = RequestMethod.GET)
public String getIndex() {
return "index";
}
@RequestMapping(value = "/new",method = RequestMethod.GET)
public String newAccount() {
return "newAccount";
}
@RequestMapping(value = "/showAccount",method = RequestMethod.GET)
public String showAccount() {
return "showAccount";
}
}