
springboot
kong-kong
记录流水账
展开
-
转发携带原始的Host
springcloud gatewayPreserveHostHeader# 路径通配匹配- id: domain_forward uri: http://localhost:10000/* # 目标服务地址 predicates: - Path=/200/* filters: # - StripPrefix=1 # 转发之前去掉1层路径 去掉/200 - PreserveHostHeader # 原始主机头nginxproxy_set_header原创 2022-03-01 19:22:00 · 1990 阅读 · 1 评论 -
spring-boot-maven-plugin
https://docs.spring.io/spring-boot/docs/2.5.4/maven-plugin/reference/htmlsingle/#packaginghttps://docs.spring.io/spring-boot/docs/2.2.6.RELEASE/maven-plugin/原创 2021-08-25 16:22:24 · 445 阅读 · 0 评论 -
Spring Boot application starters
The following application starters are provided by Spring Boot under theorg.springframework.bootgroup:Table 1. Spring Boot application starters Name Description Pom spring-boot-starter Core starter, including auto-configuratio...翻译 2021-08-17 17:09:39 · 384 阅读 · 0 评论 -
ConfigurationProperties实现
ConfigurationProperties@Target({ ElementType.TYPE, ElementType.METHOD })@Retention(RetentionPolicy.RUNTIME)@Documentedpublic @interface ConfigurationProperties { @AliasFor("prefix") String value() default ""; @AliasFor("value") String pref.原创 2021-04-02 19:54:46 · 441 阅读 · 0 评论 -
ConditionalOnProperty
ConditionalOnProperty@Retention(RetentionPolicy.RUNTIME)@Target({ ElementType.TYPE, ElementType.METHOD })@Documented@Conditional(OnPropertyCondition.class)public @interface ConditionalOnProperty { /** * Alias for {@link #name()}. * @return the原创 2021-04-01 18:33:18 · 496 阅读 · 0 评论 -
spring cloud bootstrap
spring-cloud-context单独使用SpringBoot,发现其中的bootstrap.properties文件不会生效。经过源码查看原来是因为SpringBoot本身并不支持,需要Spring Cloud才能生效。而具体的代码又在spring-cloud-context包中的org.springframework.cloud.bootstrap.BootstrapApplicationListener实现ApplicationListenerorder越小,越前...原创 2021-02-26 17:48:07 · 920 阅读 · 0 评论 -
springboot-tomcat配置参数
配置server: port: 10000 servlet: context-path: / tomcat: max-connections: 10 #默认10000 accept-count: 100 #默认100 min-spare-threads: 10 #默认10 max-threads: 200 #默认200accept-countorg.apache.tomcat.util.net.NioEndpoint# accep原创 2020-09-17 18:08:13 · 2020 阅读 · 0 评论 -
springboot配置logback-spring.xml
参考页面https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-loggingspringProperty// source来源于配置文件 比如applicaton.yml<springProperty scope="context" name="LOG_FILE_NAME" source="logging.file.name"/>原创 2020-09-08 19:09:14 · 518 阅读 · 0 评论 -
SimpleCommandLineArgsParser命令行解析
class SimpleCommandLineArgsParser { public CommandLineArgs parse(String... args) { // --priority1=program-agrs CommandLineArgs commandLineArgs = new CommandLineArgs(); for (String arg : args) { if (arg.startsWith("--")) { // 以--开头 String o..原创 2020-06-11 16:40:44 · 633 阅读 · 0 评论 -
springboot添加propertySource过程
StandardServletEnvironmentStandardServletEnvironment 添加2个 添加servletConfigInitParams 添加servletContextInitParamsprotected void customizePropertySources(MutablePropertySources propertySources) { propertySources.addLast(new StubPropertySource(SERVL...原创 2020-06-15 18:11:21 · 1305 阅读 · 0 评论 -
springboot 加载 META-INF/spring.factories
用户应用程序ApplicationConfigurableApplicationContext context = SpringApplication.run(NacosSpringBootYamlApplication.class, args);SpringApplication类public static ConfigurableApplicationContext ...原创 2020-02-25 20:08:04 · 6550 阅读 · 0 评论 -
docker使用环境变量
application.ymlzookeeper: server: 192.168.3.168my: zookeeper: server: ${ZOOKEEPER_SERVER:${zookeeper.server}}使用属性@Value("${my.zookeeper.server}")private String zookeeperServer;...原创 2019-10-30 17:25:13 · 359 阅读 · 0 评论 -
SimpleCommandLineArgsParser源码 springboot 两个横杠 --zookeeper.server实现
设置Program arguments:springboot启动类解析类: SimpleCommandLineArgsParser原创 2019-10-30 16:41:44 · 396 阅读 · 0 评论 -
idea指定启动参数、环境变量
1. 点击Edit Configurations2.# VM Arguments 是设置的虚拟机的属性# VM options# 环境变量参数 这里需要指定-D参数-server -XX:MetaspaceSize=512M -XX:MaxMetaspaceSize=1024m -Dfile.encoding=UTF-8# Program argu...原创 2019-10-30 16:32:24 · 15142 阅读 · 0 评论 -
加载application配置文件顺序
SpringApplicationloads properties fromapplication.propertiesfiles in the following locations and adds them to the SpringEnvironment: A/configsubdirectory of the current directory The ...翻译 2019-10-30 14:32:55 · 364 阅读 · 0 评论 -
springboot加载属性顺序
Spring Boot uses a very particularPropertySourceorder that is designed to allow sensible overriding of values. Properties are considered in the following order: Devtools global settings proper...翻译 2019-10-30 14:13:20 · 312 阅读 · 0 评论 -
spring boot - application-properties
https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-application-properties.html#common-application-propertieshttps://docs.spring.io/spring-boot/docs/2.2.x/reference/html...原创 2019-10-30 13:56:43 · 224 阅读 · 0 评论 -
springboot配置datasource
配置默认单个数据库# 使用springboot默认属性 配置单个数据源spring: application: name: jdbcdemo datasource: url: jdbc:mysql://192.168.5.212:8066/TESTDB?useUnicode=true&characterEncoding=UTF-8 drive...原创 2019-10-12 14:04:45 · 1021 阅读 · 0 评论 -
yaml
yamlenvironments: dev: url: https://dev.example.com name: Developer Setup prod: url: https://another.example.com name: My Cool Appproperties:environments.dev.url=https://dev.exa...翻译 2019-10-07 23:53:09 · 319 阅读 · 0 评论 -
springboot注解
# class位于类路径上,才会实例化一个Bean@ConditionalOnClass# 在当前上下文中存在某个对象时,才会实例化一个Bean@ConditionalOnBean# 当表达式为true的时候,才会实例化一个Bean@ConditionalOnExpression# 仅仅在当前上下文中不存在某个对象时,才会实例化一个Bean@ConditionalOn...原创 2019-09-11 19:05:31 · 335 阅读 · 0 评论 -
springboot工程创建
1. 打开地址https://start.spring.io/ 2. 输入相关参数3. 点击Generate Project原创 2018-09-29 14:38:10 · 294 阅读 · 0 评论 -
spring annotation
@ComponentScan 过滤以com.zyxk.sl开头的包,以ForTest结构的类@ComponentScan(basePackages = {"com.zyxk.sl.forumservice","com.zyxk.sl.ctcomponent"}, excludeFilters={ @ComponentScan.Filte...原创 2018-11-28 00:23:19 · 205 阅读 · 0 评论 -
解决LOGFILE_IS_UNDEFINED问题
logback-spring.xml<?xml version="1.0" encoding="UTF-8"?><configuration> <!-- <include resource="org/springframework/boot/logging/logback/base.xml"/> --> <原创 2018-12-18 14:57:31 · 7413 阅读 · 0 评论 -
spring logback extensions
https://docs.spring.io/spring-boot/docs/1.5.18.RELEASE/reference/htmlsingle/#boot-features-logback-extensions Spring Boot includes a number of extensions to Logback which can help with advanced co...原创 2018-12-18 14:59:07 · 533 阅读 · 0 评论 -
@ServletComponentScan
@ServletComponentScan功能:Servlet、Filter、Listener 可以直接通过 @WebServlet、@WebFilter、@WebListener 注解自动注册 @ServletComponentScan@SpringBootApplication@ServletComponentScanpublic class RateLimiterApp...原创 2018-12-18 16:35:12 · 2538 阅读 · 0 评论 -
because it is a JDK dynamic proxy that implement
springboot 启动报错cgLib 方式实现AOP代理问题当我们需要使用CGLIB来实现AOP的时候,需要配置spring.aop.proxy-target-class=true不然默认使用的是标准Java的实现,就会报错解决方法:在yml文件中加入spring: aop: proxy-target-class: true...原创 2019-05-09 17:24:47 · 565 阅读 · 0 评论 -
TimeInterceptor
@Aspect@Componentpublic class TimeInterceptor { private final Logger logger = LoggerFactory.getLogger(TimeInterceptor.class);// com.xyz.service..*.*(..) //定义在service包和所有子包里的任意类的...原创 2019-05-10 08:52:48 · 544 阅读 · 0 评论 -
idea使用spring-boot-devtools
1. 把Build Project Automatically打钩2. 按shift+ctrl+alt+/3.compiler.automake.allow.when.app.running 打钩4. 工程配置<dependencies> <!-- 热加载 --> <depe...原创 2019-08-08 15:34:16 · 317 阅读 · 0 评论 -
spring 变量
#springboot# server.port 从yml或者properties 读取@Value("${server.port}")# 未配置默认2000@Value("${remote.connectTimeout:2000}")# 未配置 则用默认值@Value("${my.server:localhost}")private String myServer;...原创 2019-08-13 16:58:58 · 316 阅读 · 0 评论 -
ConfigurationProperties使用
application.ymlmy: name: 170 port: 12000 username: root servers: - localhost - www.kq.com map: "[/key1]": value1 "[/key2]": value2 /key3: value3 name: king...原创 2019-08-13 17:00:23 · 765 阅读 · 0 评论 -
springboot笔记1
Importing Additional Configuration ClassesYou need not put all your@Configurationinto a single class. The@Importannotation can be used to import additional configuration classes. Alternative...翻译 2019-08-12 11:25:39 · 353 阅读 · 0 评论 -
eureka server配置
1. 父pom<groupId>com.kq</groupId><artifactId>spring</artifactId><packaging>pom</packaging><version>1.0.0</version><modules>原创 2018-10-12 15:39:20 · 4354 阅读 · 3 评论