Patrik Kelemen
Patrik Kelemen

Reputation: 1

Unable to get mapping to work in springboot

I have tried everything and I am unable to get springboot to map anything using @getmapping. I have previously done this in another springboot application with no issue so I confused as why I am having issues.

Here is my code for the main file.

package simplesoft.com.mainpage

import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication

@SpringBootApplication
class MainpageApplication

fun main(args: Array<String>) {
    runApplication<MainpageApplication>(*args)
}

Here is my controller code

package simplesoft.com.mainpage.controller


import org.springframework.stereotype.Controller
import org.springframework.ui.Model
import org.springframework.web.bind.annotation.GetMapping

@Controller
class WebController {

    @GetMapping("/")
    fun index(model: Model) : String {

        return "index"
    }

    @GetMapping("/bud")
    fun showpage(model: Model) : String {

        return "homepage"
    }
}

the folder structure of the project Here is the folder structure

When I Run the application and try to go there is not mapping message in springboot and I get a 404 error when trying to access the page I have re-built the application from the spring starter website and still have the same issue.

Upvotes: 0

Views: 42

Answers (0)

Related Questions