草庐IT

component-parent

全部标签

Java Swing : Enabling/Disabling all components in JPanel

我有一个JPanel,其中包含一个JToolbar(包括几个没有文本的按钮)和一个JTable,我需要启用/禁用(使内部小部件不可点击)。我试过这个:JPanelpanel=....;for(Componentc:panel.getComponents())c.setEnabled(enabled);但它不起作用。是否有更好、更通用的解决方案来启用/禁用JPanel中的所有内部组件?从这里的示例开始,我已经使用JLayer部分解决了我的问题http://docs.oracle.com/javase/tutorial/uiswing/misc/jlayer.html:layer=newJ

java - org.codehaus.plexus.component.repository.exception.ComponentLookupException : java. util.NoSuchElementException

我尝试测试我的Maven插件并收到奇怪的异常。发现类似问题here,但答案没有帮助。pom.xmlorg.apache.mavenmaven-plugin-api3.3.9org.apache.mavenmaven-project3.0-alpha-2com.jcabijcabi-aether0.10.1org.apache.maven.plugin-toolsmaven-plugin-annotations3.4providedorg.apache.maven.plugin-testingmaven-plugin-testing-harness3.3.0testorg.apache.

java - 启动 Neo4j 失败 : Component was successfully initialized, 但未能启动

我正在学习Pluralsight上的Neo4J教程,我必须使用drwho(神秘博士)示例数据库。我正在使用Neo4j社区版3.0.1版。但是示例数据库(drwho)是由旧版本制作的,我必须将dbms.allow_format_migration属性设置为"true"。这样做之后,当我尝试启动服务器时,它弹出了这个错误StartingNeo4jfailed:Component'org.neo4j.server.database.LifecycleManagingDatabase@673b0b17'wassuccessfullyinitialized,butfailedtostart.Pl

java - @Component 和@Repository/@Service 注解的处理方式有什么区别?

我今天在使用Spring3.0时偶然发现了一个相当奇怪的问题:有一个抽象类A及其具体实现A_Impl.A_Impl注释为@Repository并由Spring自动扫描(和都在上下文中声明)。A和A_Impl部署在单独的JAR中(不确定这是否重要)。一切正常。现在,我正在审查该代码和@Repository在语义上似乎不太合适(所讨论的类与持久性无关)所以-以我无限的智慧-我决定将其更改为更通用的@Component.不用说,一切都爆炸了,让我看起来像个彻头彻尾的白痴。错误(在Spring上下文初始化期间发生)是Spring的ClassPathResource.getInputStream

java - spring-boot-starter-parent 在 pom 文件中到底做了什么?

我正在开发一个项目,它不是Springboot,而是springmvc。我的意思是我的项目中没有这个类:@SpringBootApplicationpublicclassApplicationextendsSpringBootServletInitializer{publicstaticvoidmain(String[]args){SpringApplication.run(Application.class,args);}我在springmvc的配置文件中有这三个类:@Import(WebSocketConfig.class)@Configuration@EnableWebMvc@C

java - Spring @Component 类必须是公开的吗?

我想将组件的接口(interface)公开为接口(interface),实现类将受到包保护(可能在其他包中):packagebaz.ifaceinterfaceFoo{voidbar();}packagebaz.whatever@ComponentclassSpringyFooimplementsbaz.iface.Foo{publicvoidbar(){frobnicate();}}假设baz.whatever在component-scan中,Spring是否能够在其他地方Autowiringbaz.iface.Foo?classFooClient{@Autowiredprivate

java - 同一个类上注解Entity和Component是不是错了

将来自spring@Component和JPA@Entity的注释放在同一个类上是错误的想法吗?为什么需要它是在JSF页面上使用这个类,它还描述了表结构。原因是为了避免将实体对象映射到将成为表示层的某个值对象。这是一些反模式吗?你有更好的解决方案吗? 最佳答案 Isitwrongideatoputannotationfromspring@ComponentandJPA@Entityonthesameclass.这是Controller和模型的紧耦合。WhyItisneededistousethisclassonJSFpageanda

java - Spring 3 注释配置选择@Configuration 和@Component 但不是@Controller

因此,我尝试在没有XML的情况下配置我的网络应用程序,并采用所有带注释的路线。我有几个用@Configuration和@Component注释的类,它们会自动获取,但由于某些原因,我的@Controller注释没有被识别并映射到它们相应的@RequestMapping值。我的web.xml文件如下所示:timbuk2-webapp-Compositorlog4jConfigLocation/WEB-INF/conf/log4j-config.xmlcontextClassorg.springframework.web.context.support.AnnotationConfigWe

java - 在 JShell 中访问 "parent scope"

看来,在另一个JShell中创建的JShell对象无法访问父级的JShell范围。例如:jshell>intx=1;x==>1jshell>xx==>1jshell>jdk.jshell.JShelljs=jdk.jshell.JShell.create();js==>jdk.jshell.JShell@1a052a00jshell>js.eval("x");$4==>[SnippetEvent(snippet=Snippet:ErroneousKey#1-x,previousStatus=NONEXISTENT,status=REJECTED,isSignatureChange=fa

java - 是否可以将使用 @Component 定义的 bean 作为 BeanFactoryPostProcessor 的参数注入(inject)?

如果需要,需要哪种配置?这是不推荐的吗?带注释的类:packagecom.springbug.beanfactorydependencyissue;importjavax.annotation.Resource;importorg.springframework.stereotype.Component;@ComponentpublicclassDependantBean{@ResourceDependencyBeandependencyBean;//Isn'tinitializedcorrectlypublicDependencyBeangetDependencyBean(){ret