会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 133501个问题

@EnableAdminServer

在spring boot启动类中,为什么加入不了该注解@EnableAdminServer

该项目的pom文件:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.10.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.wjf</groupId>
    <artifactId>springbootactuatorserver</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>springbootactuatorserver</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
       <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-server</artifactId>
            <version>2.1.6</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>


JAVA 全系列/(旧的隐藏)第十一阶段:spring全家桶(Spring Boot)/Spring Boot 34141楼
Python 全系列/第四阶段:函数式编程和核心特性/函数式编程 34142楼
JAVA 全系列/第一阶段:AI驱动的JAVA编程/控制语句、方法、递归算法 34143楼
JAVA 全系列/第一阶段:AI驱动的JAVA编程/控制语句、方法、递归算法 34144楼

class Node():
    def __init__(self,value=None,next=None):
        self.value = value 
        self.next = next    def __str__(self):
        return 'Node:{}'.format(self.value)class LinkedList():
    def __init__(self):
        self.root = Node()
        self.size = 0 #记录有多少元素
        self.next = None  #增加新数据时,将新数据的地址与谁关联

    def append(self,value):
        node = Node(value)        # 判断是否已经有数据
        if not self.next: #如果没有节点时
            self.root.next = node #将新节点挂到root后面
        else:
            self.next.next = node #将新节点挂到最后一个节点上
        self.next = node
        self.size += 1
    def append_first(self,value):
        node = Node(value)        if not self.next:
            self.root.next = node
            self.next = node        else:
            temp = self.root.next  # 获取原来root后面的那个节点
            self.root.next = node  # 将新的节点挂到root上
            node.next = temp # 新的节点的下一个节点是原来的root后的节点
        self.size += 1

    def __iter__(self):
        current = self.root.next        if current:            while current is not self.next:                yield current.value
                current = current.next            yield current.value    def find(self,value):
        for v in self.__iter__():            if v == value:                return True
    def find2(self,value):
        current = self.root.next        if current:            while current is not self.next:                if current.value == value:                    return current
                current = current.next    def remove(self,value):
        current = self.root.next        if current:            while current is not self.next: 
                if current.value == value:
                    temp.next = current.next                    del current
                    self.size -= 1
                    return True
                temp = current
                current = current.nextif __name__ == "__main__":
    link = LinkedList()
    link.append('孙悟空')
    link.append('猪八戒')
    link.append_first('唐僧')    for v in link:
        print(v)    # print(link.find('孙悟空'))
    # print(link.find('六儿猕猴'))
    # print(link.find2('孙悟空'))
    # print(link.find2('六儿猕猴'))
    print('-'*30)
    link.remove('孙悟空')    for v in link:
        print(v)

老师,你这代码这块image.png

image.png存在巨大的问题,只有删除中间数据的时候不报错,删除第一个的时候会显示temp没有定义,最后一个怎么也删除不了,好好看看,然后课程改进一下吧,容易误导人

Python 全系列/第十七阶段:数据结构与算法/算法与数据结构(旧) 34145楼
JAVA 全系列/第二阶段:JAVA 基础深化和提高/常用类 34148楼
JAVA 全系列/第二阶段:JAVA 基础深化和提高/网络编程(旧) 34150楼
JAVA 全系列/第二阶段:JAVA 基础深化和提高/IO 流技术(旧) 34154楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637