nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial
Spring Boot Starter Webflux
阅读全文
nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial
GuavaRateLimiter1234567891011121314151617RateLimiter rateLimiter = RateLimiter.create(10);for (int i = 0; i < 20; i++) { int finalI = i; new Thread(new Runnable() { @Override public void run() { int cnt = 0; while (true) { if (rateLimiter.tryAcquire()) { cnt++; System.out.println("thread: " + finalI + " cnt: " + cnt); } } } }).start();}Thread.sleep(1000 * 100 * 1000);
阅读全文
nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial
入门资料中文文档官方文档中文文档社区嘿嘿
阅读全文
nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial
微服务于微服务架构微服务强调服务的大小,他关注某一个点,一个模块只做一种事情微服务架构通常而言,他提倡将单一的程序划分为一组小的服务,每个服务运行在独立的进程中,采用轻量级的通信机制 doubbo是rpc,springcloud是restful
阅读全文
nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial
如何编写理清依赖自动配置@Configuration 指定这个是配置类@ConditionalOnxxx 在某些条件下才生效@AutoConfigureAfter 指定自动配置类的顺序@Bean 给IOC加组件@ConfiguretionProperties 结合相关的xxxProperties配置类来绑定配置@EnableConfigurationProperties 让xxxProperties生效加入到容器中讲自动配置类配置在META-INF/spring.factories中
阅读全文
nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial
启动配置原理几个重要的事件回调机制
ApplicationContextInitializer
SpringApplicationRunListener
ApplicationRunner
CommandLineRunner
启动流程1return new SpringApplication(primarySources).run(args);
创建SpringApplication对象
运行run方法
创建对象现在左边的参数是null
123456789101112public SpringApplication(Class<?>... primarySources) { this(null, primarySources);}public SpringApplication(ResourceLoader resourceLoader, Class<?>... primarySources) { this.resourceLoader = resourceLoader; Assert.notNull(primarySources, "PrimarySources must not be null"); this.primarySources = new LinkedHashSet<>(Arrays.asList(primarySources)); this.webApplicationType = WebApplicationType.deduceFromClasspath(); setInitializers((Collection) getSpringFactoriesInstances(ApplicationContextInitializer.class)); setListeners((Collection) getSpringFactoriesInstances(ApplicationListener.class)); this.mainApplicationClass = deduceMainApplicationClass();}
阅读全文
nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial
创建项目选择MySQL+JDBC+Web
链接数据库123456spring: datasource: username: root password: 123456 url: jdbc:mysql://localhost:3306/jdbc driver-class-name: com.mysql.jdbc.Driver
阅读全文