小编LqS*_*qS2的帖子

Springboot 在 Eureka 客户端依赖项上运行失败

当我将它添加到我的项目父 pom 时:

    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
      <version>2.1.3.RELEASE</version>
    </dependency>
Run Code Online (Sandbox Code Playgroud)

项目运行失败,如下所示:

    2019-11-11 00:12:56.158  INFO 78547 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
    2019-11-11 00:12:56.421  INFO 78547 --- [  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$684316fc] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
    2019-11-11 00:12:56.436  WARN 78547 --- [  restartedMain] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with …
Run Code Online (Sandbox Code Playgroud)

java netflix-eureka

12
推荐指数
2
解决办法
1万
查看次数

一个简单的java多线程

好吧,我遇到了一个惊人的问题......

public class Test {
    private boolean[] state = new boolean[]{false, false};

    public void createThread() {
        Thread th1  = new Thread(() -> {
            try {
                System.out.println("1");
                Thread.sleep(2000);
                state[0]=true;
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });
        Thread th2 = new Thread(() -> {
            try {
                System.out.println("2");
                Thread.sleep(2000);
                state[1] = true;
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

        });
        th1.start();
        th2.start();
    }
    public static void main(String args[]) throws InterruptedException {
        Test test = new Test();
        test.createThread();
        while (true) {
//            Thread.sleep(1); …
Run Code Online (Sandbox Code Playgroud)

java multithreading

6
推荐指数
1
解决办法
99
查看次数

Collections.unmodifiableCollection 返回值

List<Integer> integers = Arrays.asList(1, 2);
List<Integer> integers2 = Arrays.asList(1, 2);
Collection<Integer> integers3 = Collections.unmodifiableCollection(integers);
Collections.unmodifiableCollection(integers2);
integers3.add(3);
integers2.add(3); 
Run Code Online (Sandbox Code Playgroud)

我知道执行integers3.add()会抛出 UnsupportedOperationException,但 integers2 没有改变实例。我查看了 Collections.unmodifiableCollection(Collection ..) 的源代码,但是 integers2 的实现也从 AbstractList 抛出了 UnsupportedOperationException。为什么是这样?

java

-1
推荐指数
1
解决办法
88
查看次数

标签 统计

java ×3

multithreading ×1

netflix-eureka ×1