最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - what actually @SpringBootApplication(scanBasePackages = {}) do in spring boot project? - Stack Overflow

programmeradmin3浏览0评论
package com.demo;

import .springframework.boot.SpringApplication;
import .springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication(scanBasePackages = {"com.controller"})
public class DemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
}

This is my demo package, where the main() locates...

package com.controller;

import .springframework.web.bind.annotation.GetMapping;
import .springframework.web.bind.annotation.RestController;

@RestController
public class AuthController {

    @GetMapping(value = "/welcome")
    public String welocome() {
        return "welcome bro..";
    }
}

and this is my controller package, where I put my RestController here.

what actually works under the hood when I declare @SpringBootApplication(scanBasePackages = {"com.controller"}) in my demo package?

I just want to know, what's running behind the scenes..!

发布评论

评论列表(0)

  1. 暂无评论