SpringBoot项目启动卡死问题调查

这篇具有很好参考价值的文章主要介绍了SpringBoot项目启动卡死问题调查。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

一、背景

今天,项目代码在合并了一个分支之后,启动卡死,无法正常启动

二、调查

首先,我们在IDEA中切换到那个有问题的分支,将日志改成DEBUG模式,启动,发现日志卡在了创建单例对象bohTokenUtil这里,而bohTokenUtil确实是新加入的代码

2023-03-08 18:43:20,766 DEBUG [ ] [main] o.s.b.f.s.DefaultListableBeanFactory: Creating shared instance of singleton bean 'mybatis-org.mybatis.spring.boot.autoconfigure.MybatisProperties'
2023-03-08 18:43:20,832 DEBUG [ ] [main] o.s.b.f.s.DefaultListableBeanFactory: Autowiring by type from bean name 'org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration' via constructor to bean named 'mybatis-org.mybatis.spring.boot.autoconfigure.MybatisProperties'
2023-03-08 18:43:20,832 DEBUG [ ] [main] o.s.b.f.s.DefaultListableBeanFactory: Autowiring by type from bean name 'org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration' via constructor to bean named 'org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@38c2c309'
2023-03-08 18:43:20,846 DEBUG [ ] [main] o.s.b.f.s.DefaultListableBeanFactory: Autowiring by type from bean name 'sqlSessionFactory' via factory method to bean named 'dataSource'
2023-03-08 18:43:20,856 DEBUG [ ] [main] o.m.spring.SqlSessionFactoryBean: Property 'mapperLocations' was not specified.
2023-03-08 18:43:20,860 DEBUG [ ] [main] o.s.b.f.s.DefaultListableBeanFactory: Creating shared instance of singleton bean 'sqlSessionTemplate'
2023-03-08 18:43:20,860 DEBUG [ ] [main] o.s.b.f.s.DefaultListableBeanFactory: Autowiring by type from bean name 'sqlSessionTemplate' via factory method to bean named 'sqlSessionFactory'
2023-03-08 18:43:20,929 DEBUG [ ] [main] o.s.b.f.s.DefaultListableBeanFactory: Creating shared instance of singleton bean 'interfaceRunningService'
2023-03-08 18:43:20,946 DEBUG [ ] [main] o.s.b.f.s.DefaultListableBeanFactory: Creating shared instance of singleton bean 'bohTokenUtil'

同时也看了下启动之后的线程情况,发现线程卡死在了ConcurrentHashMap的computeIfAbsent方法

"main" #1 prio=5 os_prio=0 tid=0x0000000002d35800 nid=0x9cec runnable [0x0000000002c29000]
java.lang.Thread.State: RUNNABLE
at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1718)
at org.springframework.cache.concurrent.ConcurrentMapCache.get(ConcurrentMapCache.java:144)
at com.ulisesbocchio.jasyptspringboot.caching.CachingDelegateEncryptablePropertySource.getProperty(CachingDelegateEncryptablePropertySource.java:34)
at com.ulisesbocchio.jasyptspringboot.wrapper.EncryptableMapPropertySourceWrapper.getProperty(EncryptableMapPropertySourceWrapper.java:31)
at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:85)
at org.springframework.core.env.PropertySourcesPropertyResolver.getPropertyAsRawString(PropertySourcesPropertyResolver.java:74)
at org.springframework.core.env.AbstractPropertyResolver$$Lambda$22/1727361096.resolvePlaceholder(Unknown Source)
at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:151)
at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:124)
at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:237)
at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:211)
at org.springframework.core.env.AbstractEnvironment.resolveRequiredPlaceholders(AbstractEnvironment.java:575)
at com.ulisesbocchio.jasyptspringboot.resolver.DefaultPropertyResolver$$Lambda$239/2091586824.apply(Unknown Source)
at java.util.Optional.map(Optional.java:215)
at com.ulisesbocchio.jasyptspringboot.resolver.DefaultPropertyResolver.resolvePropertyValue(DefaultPropertyResolver.java:38)
at com.ulisesbocchio.jasyptspringboot.resolver.DefaultLazyPropertyResolver.resolvePropertyValue(DefaultLazyPropertyResolver.java:42)
at com.ulisesbocchio.jasyptspringboot.EncryptablePropertySource.getProperty(EncryptablePropertySource.java:20)
at com.ulisesbocchio.jasyptspringboot.caching.CachingDelegateEncryptablePropertySource.lambda$getProperty$0(CachingDelegateEncryptablePropertySource.java:34)
at com.ulisesbocchio.jasyptspringboot.caching.CachingDelegateEncryptablePropertySource$$Lambda$216/194408994.call(Unknown Source)
at org.springframework.cache.concurrent.ConcurrentMapCache.lambda$get$0(ConcurrentMapCache.java:146)
at org.springframework.cache.concurrent.ConcurrentMapCache$$Lambda$217/990830650.apply(Unknown Source)
at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
locked <0x000000077d130ce8> (a java.util.concurrent.ConcurrentHashMap$ReservationNode)
at org.springframework.cache.concurrent.ConcurrentMapCache.get(ConcurrentMapCache.java:144)
at com.ulisesbocchio.jasyptspringboot.caching.CachingDelegateEncryptablePropertySource.getProperty(CachingDelegateEncryptablePropertySource.java:34)
at com.ulisesbocchio.jasyptspringboot.wrapper.EncryptableMapPropertySourceWrapper.getProperty(EncryptableMapPropertySourceWrapper.java:31)
at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:85)
at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:62)
at org.springframework.core.env.AbstractEnvironment.getProperty(AbstractEnvironment.java:539)
at org.springframework.context.support.PropertySourcesPlaceholderConfigurer$1.getProperty(PropertySourcesPlaceholderConfigurer.java:137)
at org.springframework.context.support.PropertySourcesPlaceholderConfigurer$1.getProperty(PropertySourcesPlaceholderConfigurer.java:133)
at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:85)
at org.springframework.core.env.PropertySourcesPropertyResolver.getPropertyAsRawString(PropertySourcesPropertyResolver.java:74)
at org.springframework.core.env.AbstractPropertyResolver$$Lambda$22/1727361096.resolvePlaceholder(Unknown Source)
at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:145)
at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:124)
at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:237)
at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:211)
at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.lambda$processProperties$0(PropertySourcesPlaceholderConfigurer.java:175)
at org.springframework.context.support.PropertySourcesPlaceholderConfigurer$$Lambda$187/632841653.resolveStringValue(Unknown Source)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveEmbeddedValue(AbstractBeanFactory.java:851)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1185)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1164)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1378)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:575)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$153/605705199.getObject(Unknown Source)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
locked <0x00000006c4927600> (a java.util.concurrent.ConcurrentHashMap)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:277)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1244)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1164)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1378)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:575)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$153/605705199.getObject(Unknown Source)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
locked <0x00000006c4927600> (a java.util.concurrent.ConcurrentHashMap)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:525)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:496)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:630)
at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:180)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessProperties(CommonAnnotationBeanPostProcessor.java:321)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1378)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:575)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$153/605705199.getObject(Unknown Source)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
locked <0x00000006c4927600> (a java.util.concurrent.ConcurrentHashMap)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:525)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:496)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:630)
at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:180)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessProperties(CommonAnnotationBeanPostProcessor.java:321)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1378)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:575)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$153/605705199.getObject(Unknown Source)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
locked <0x00000006c4927600> (a java.util.concurrent.ConcurrentHashMap)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:846)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:863)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
locked <0x00000006c3fec3a0> (a java.lang.Object)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
at com.rydeen.boh.InterfaceApplication.main(InterfaceApplication.java:18)

沿着栈信息往下看,发现是在populateBean之后出现的异常,怀疑是属性填充导致的问题

SpringBoot项目启动卡死问题调查

于是看类bohTokenUtil的属性,终于发现了问题

SpringBoot项目启动卡死问题调查

这里使用了@Value来引入配置文件里的配置

SpringBoot项目启动卡死问题调查

判断前后名称写的一致,导致了死循环,于是将bohTokenCacheExpireInSeconds改成了BOH_TOKEN_CACHE_EXPIRE_IN_SECONDS再次启动,终于可以正常启动了

三、事后分析

后来我就好奇,为什么就会卡死了呢,为什么不报错,看栈信息,最后应该是卡死在了ConcurrentHashMap的computeIfAbsent方法上,于是就去跟了下源码,找到了调用computeIfAbsent方法的地方,是ConcurrentMapCache的get方法

SpringBoot项目启动卡死问题调查

这个this.store就是一个ConcurrentHashMap,可以看到computeIfAbsent的第二个参数是一个Lambda表达式,在里面又调用了get方法里传过来的valuLoader.call()方法,又往上去找调用的地方,是CachingDelegateEncryptablePropertySource的getProperty方法

SpringBoot项目启动卡死问题调查

发现valuLoader也是个Lambda表达式,调用的是getProperty方法,这个方法最终还是会调用到CachingDelegateEncryptablePropertySource的getProperty方法,我们通过之前的栈信息也可以看到调用了两次

SpringBoot项目启动卡死问题调查

所以相当于并发操作了ConcurrentHashMap的computeIfAbsent方法,放入了同一个key,所以怀疑是不是这种情况会有问题,于是又跟了下computeIfAbsent的源码

public V computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) {
    if (key == null || mappingFunction == null)
        throw new NullPointerException();
    //两个相同的key一定是相同的hashCode,所以h也是一样的
    int h = spread(key.hashCode());
    V val = null;
    int binCount = 0;
    for (Node<K,V>[] tab = table;;) {
        Node<K,V> f; int n, i, fh;
        if (tab == null || (n = tab.length) == 0)
            tab = initTable();
        else if ((f = tabAt(tab, i = (n - 1) & h)) == null) {
            //1、key1会走进这里,创建一个占位的Node,这样会导致key2这里不会进来
            Node<K,V> r = new ReservationNode<K,V>();
            synchronized (r) {
                if (casTabAt(tab, i, null, r)) {
                    binCount = 1;
                    Node<K,V> node = null;
                    try {
                        //2、调用Lambda表达式,进行计算等待返回值
                        if ((val = mappingFunction.apply(key)) != null)
                            node = new Node<K,V>(h, key, val, null);
                    } finally {
                        //将计算结果创建Node,顶替掉占位的Node
                        setTabAt(tab, i, node);
                    }
                }
            }
            if (binCount != 0)
                break;
        }
        else if ((fh = f.hash) == MOVED)
            tab = helpTransfer(tab, f);
        else {
            //由于key1占住了位置,所以key2会走到这里
            boolean added = false;
            synchronized (f) {
                if (tabAt(tab, i) == f) {
                    if (fh >= 0) {
                        //key2不满足这个条件
                        binCount = 1;
                        for (Node<K,V> e = f;; ++binCount) {
                            K ek; V ev;
                            if (e.hash == h &&
                                ((ek = e.key) == key ||
                                 (ek != null && key.equals(ek)))) {
                                val = e.val;
                                break;
                            }
                            Node<K,V> pred = e;
                            if ((e = e.next) == null) {
                                //key2会走这里
                                if ((val = mappingFunction.apply(key)) != null) {
                                    added = true;
                                    pred.next = new Node<K,V>(h, key, val, null);
                                }
                                break;
                            }
                        }
                    }
                    else if (f instanceof TreeBin) {
                        //key2也不满足这个条件
                        binCount = 2;
                        TreeBin<K,V> t = (TreeBin<K,V>)f;
                        TreeNode<K,V> r, p;
                        if ((r = t.root) != null &&
                            (p = r.findTreeNode(h, key, null)) != null)
                            val = p.val;
                        else if ((val = mappingFunction.apply(key)) != null) {
                            added = true;
                            t.putTreeVal(h, key, val);
                        }
                    }
                }
            }
            if (binCount != 0) {
                if (binCount >= TREEIFY_THRESHOLD)
                    treeifyBin(tab, i);
                if (!added)
                    return val;
                break;
            }
        }
    }
    if (val != null)
        addCount(1L, binCount);
    return val;
}

发现key1会走第12行和第21行,在21行会调用Lambda表达式等待结果,这时候key2会进来,发现key1已经占住了位置,会走36行的else里,而key2不满足39行和61行的if条件,循环中没有可以跳出的地方,就陷入了死循环。后来上网了解,这是jdk1.8的一个bug,在1.9中得到了解决,在后面补充了一个else if,如果是ReservationNode类型就抛IllegalStateException异常,文章来源地址https://www.toymoban.com/news/detail-453567.html

else if (f instanceof ReservationNode)
    throw new IllegalStateException("Recursive update");

到了这里,关于SpringBoot项目启动卡死问题调查的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 解决启动SpringBoot项目报错:Unsatisfied dependency expressed through field ‘baseMapper‘.....问题

    Unsatisfied dependency expressed through field \\\'baseMapper\\\',XXXMapper包扫描不到 当你看到这样的报错,你会怎么解决呢: Unsatisfied dependency expressed through field \\\'baseMapper\\\'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type \\\'com.memory.memoryiconbackend.mapper.Wallpape

    2024年02月08日
    浏览(59)
  • springboot 设置自定义启动banner背景图 教程

    Spring Boot中的banner是在应用程序启动时显示的一个ASCII艺术字符或文本。它被用来给用户展示一些关于应用程序的信息,例如名称、版本号或者公司标志等。 使用Spring Boot的默认设置,如果项目中有一个名为“banner.txt”的文件放置在classpath下的“/META-INF”目录中,那么这个文

    2024年02月12日
    浏览(31)
  • springboot 项目启动不打印spring 启动日志

    今天项目遇到一个很奇怪的问题,服务在启动时,不打印spring 的启动日志。经过排查发现是因为其他的依赖引入了 log4j 的依赖,因为我们的项目用的是logback,所以项目中没有log4j 的相关配置,所以干扰到了日志的打印 下面是log4j缺失配置文件的告警日志: log4j:WARN No append

    2024年02月11日
    浏览(56)
  • 问卷调查|在线问卷调查系统|基于Springboot的在线问卷调查系统设计与实现(源码+数据库+文档)

    在线问卷调查系统目录 目录 基于Springboot的在线问卷调查系统设计与实现 一、前言 二、系统设计 三、系统功能设计  1、问卷管理 2、 问卷调查管理 3、题目管理 4、 用户管理 四、数据库设计  1、实体ER图 五、核心代码  六、论文参考 七、最新计算机毕设选题推荐 八、源码

    2024年03月12日
    浏览(50)
  • SpringBoot项目没有启动按键

    问题一: pom文件正常,但是springboot包报红,同时Plugin ‘org.springframework.boot:spring-boot-maven-plugin:‘ not found报红 解决办法: 无法识别使用哪个版本的 spring-boot-maven-plugin 包 问题二: 没有启动按键,即下图中JavaDemoApplication这里是灰色的或是Current File 解决办法: 如图中,将src包

    2024年03月10日
    浏览(62)
  • java之SpringBoot项目打包与项目启动

    执行 Maven 构建指令 package 即使在没有明确想法的情况下,打包Spring Boot项目通常遵循标准的步骤,这是一个通用的流程。 确认环境 确保开发环境中已经安装了Java和Maven或Gradle。最终的打包指令取决于使用的构建工具。 编写代码 如果已经有一个Spring Boot项目,确保代码已经编

    2024年02月11日
    浏览(40)
  • springboot项目如何配置启动端口

    项目启动需要一个独立的端口,所以在此记录一下。 根据配置文件的后缀书写格式略有不同。 若是.yaml后缀的配置文件,那么端口书写为 此格式切记缩进 若是.properties后缀的配置文件,那么端口书写为 两端使用等号链接 设置–工具–终端–环境变量: server.port=端口号 因为

    2024年02月03日
    浏览(40)
  • VSCode配置启动springboot项目

    本人前一段时间使用intellij,发现配置较为复杂,于是尝试用VSCode配置,发现比intellij稍方便些。写下记录以便个人往后用。 JDK下载链接:https://www.oracle.com/cn/java/technologies/downloads/#jdk20-windows 选择x64 Installer下载并安装 Maven下载链接:https://maven.apache.org/download.cgi 选择Binary zip

    2024年02月16日
    浏览(37)
  • Maven命令启动SpringBoot项目

    用Maven命令启动SpringBoot项目,记录如下: mvn spring-boot:run C:UsersAdministratorsourcereposkd-datacenterserverkd-datacentermvn spring-boot:run  

    2024年02月13日
    浏览(44)
  • SpringBoot 项目的创建与启动

    ✅作者简介:2022年 博客新星 第八 。热爱国学的Java后端开发者,修心和技术同步精进。 🍎个人主页:Java Fans的博客 🍊个人信条:不迁怒,不贰过。小知识,大智慧。 💞当前专栏:SpringBoot 框架从入门到精通 ✨特色专栏:国学周更-心性养成之路 🥭本文内容:SpringBoot 项目

    2024年02月03日
    浏览(35)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包