1、exclude

不装配指定bean

@SpringBootApplication(exclude={com.ebc.User.class})

2、scanBasePackages

package com.ebc;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
//scanBasePackages 后边的值,是一个数组。即可指定多个不同的包
@SpringBootApplication(scanBasePackages = "com.yst")
public class App {
public static void main(String[] args) {
SpringApplication.run(App.class, args);
}
}
package com.yst;

import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.web.context.WebServerApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono; import static org.springframework.web.reactive.function.server.RequestPredicates.GET;
import static org.springframework.web.reactive.function.server.RouterFunctions.route;
import static org.springframework.web.reactive.function.server.ServerResponse.ok; @Configuration
public class WebConfiguration {
/**
* 浏览器地址栏中输入:http://localhost:8080/hello-world,回车后,输出:Hello,World
* @return
*/
@Bean
public RouterFunction<ServerResponse> helloworld() {
return route(GET("/hello"),request->ok().body(Mono.just("Hello,遥远2"),String.class));
} /**
* 在spring boot应用启动后回调
* @param context
* @return
*/
@Bean
public ApplicationRunner runner(WebServerApplicationContext context) {
return args -> {
System.out.println("当前WebServer实现类为:"+context.getWebServer().getClass().getName());
};
}
}

运行http://localhost:8080/hello

输出:Hello,遥远2

说明,成功。

最新文章

  1. 将DataTable中的某列转换成数组或者List
  2. 使用ssh连接gitHub
  3. C#事件学习
  4. Struts2 DomainModel、ModelDriven接收参数
  5. Android 自动化测试 Emmagee
  6. TestLink安装全攻略
  7. (九)play之yabe项目【发表博文】
  8. c# Start/Stop/Check Status远程计算机的Windows Service
  9. 开发基于Handoff的App(Swift)
  10. Valgrind简单用法
  11. linux内核设计与实现--从内核出发
  12. URI中的常用属性
  13. 软件工程课后作业——四则运算Ⅲ(C++)
  14. access数据库的连接字符串以及数据库操作类
  15. zookeeper数据弱一致性
  16. NodeJS常用模块介绍
  17. discuz网站数据库迁移
  18. Java课程设计——GUI密码生成器201521123035
  19. c++11の死锁
  20. Java最小化镜像制作

热门文章

  1. Windows编程常用api
  2. 5G/NR 波束管理
  3. 继OpenJDK 之后,OpenJFX也将迁移到 Git
  4. APM概述
  5. 免杀PHP一句话一枚
  6. 2013蓝桥杯预赛C/C++本科B组
  7. java不要登录发送邮件noReply
  8. Python在运行中发生错误怎么正确处理方法,案例详解!
  9. Vue父组件向子组件传值
  10. 已解决!kali桌面无法放置快捷方式问题