小编Sup*_*upo的帖子

Intellij IDEA与ideavim.无法从其他来源复制文本

我尝试使用ideavim插件从IDEA复制文本,使用默认的vim键绑定(y).但是这个文本没有复制到全局缓冲区中,我只能在IDEA中粘贴它.
例如,如何在浏览器中使用复制的文本?

buffer copy intellij-idea ideavim

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

Spring Boot @Autowired在运行时创建实例

作为大多数Spring Boot新用户,我遇到了@Autowired:D的问题

我在这里引用了关于这个注释的大量话题,但仍然无法找到适合我的问题的解决方案.

我们假设我们有这个Spring Boot层次结构:

@SpringBootApplication
public class DemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
}
Run Code Online (Sandbox Code Playgroud)

类,我们想要每次调用时实例化:

@Service
public class TestWire {
    public TestWire() {
        System.out.println("INSTANCE CREATED: " + this);
    }
}
Run Code Online (Sandbox Code Playgroud)

out get controller,每次请求都会创建新的SomeRepo对象:

@RestController
public class CreatingRepo {
    @RequestMapping("/")
    public void postMessage() {
        SomeRepo repo = new SomeRepo();
    }
}
Run Code Online (Sandbox Code Playgroud)

最后,使用@Autowired创建TestWire实例的类:

public class SomeRepo {
    @Autowired
    private TestWire testWire;

    public SomeRepo() {
        System.out.println(testWire.toString());
    }
}
Run Code Online (Sandbox Code Playgroud)

我们假设,我们多次向"/"发出GET请求.

因此,因此,只有在项目构建时,TestWire类才会同步,并且@Scope(value ="prototype")proxyMode = ScopedProxyMode.TARGET_CLASS都不 …

java spring dependency-injection autowired spring-boot

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