Announcement Announcement Module
Collapse
No announcement yet.
Spring Explorer with Java-based Web-Container configuration Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Explorer with Java-based Web-Container configuration

    Hello,

    i configure my WebApp with the javax.servlet.ServletContainerInitializer respecitve with a WebApplicationInitializer, and Java based Configuration.
    Is there a way to configure the Spring Eplorer View of STS to show the Configuration and the Dependency Graph correctly?

    A Google & a Forum search was without result.

    Any hint will be helpful for me..

    Best Regards,
    Gianpietro Dal Zio

  • #2
    Hey!

    The tooling doesn't recognize the Spring configuration at the moment if there is not a single configuration file. This should definitely be changed to support this scenario. I filed an enhancement request for this:
    https://issuetracker.springsource.com/browse/STS-2309

    In the meantime you could add a simple configuration file that contains the component-scanning definition and add that to the list of used config files for the project. This is a somewhat ugly workaround (I know), but it should at least work.

    -Martin

    Comment


    • #3
      Hello Martin,

      thak you very much for your answer, and for the enhancement request.
      I already try the "simple configuration file" workaround; bud it does not work really good, the recongnition of the dependencies between Beans are not recognized:

      Code:
      @Bean
      public TesterBean testerBean()
      {
      	TesterBean tb = null;
      	try
      		{
      			tb = new TesterBean(this.entityManager());
      		}
      	catch (Throwable e)
      		{
      		// TODO Auto-generated catch block
      			e.printStackTrace();
      		}
      		tb.init();
      		return tb;
      		}
      The graphs shows the #testerBean but not the dependency with the #entityManager bean...

      Tank you!
      -Gianpietro

      Comment


      • #4
        Hey Gianpietro!

        The beans graph is not yet able to analyse those dependencies between beans that are coming from inside @Bean configurations. This is somewhat complex to analyze and to implement because of the wide variety of possibilities and ways to configure beans using this style. Nevertheless, I think it would be great to have those dependencies within that graph as well. I opened this JIRA issue to track this:
        https://issuetracker.springsource.com/browse/STS-2318

        Cheers,
        -Martin

        Comment


        • #5
          Thank you Martin,

          Gianpietro

          Comment


          • #6
            Hi Martin,

            I too came across the problem that the "Spring Explorer" doesn't show me beans for my purely annotation-driven Spring project (... I'm currently playing around with the spring-social-showcase ).

            I tried your workaround using a simple configuration file.

            In the project's src/main/java folder, I created a file componentscan.xml with the following content
            Code:
            <beans xmlns="http://www.springframework.org/schema/beans"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xmlns:context="http://www.springframework.org/schema/context"
                   xsi:schemaLocation="
                        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
            
                   <context:component-scan base-package="org.springframework.social.showcase"/>
            
            </beans>
            Then I added this xml file to the "Beans Support config file list": Project properties -> Spring -> Beans Support -> Config Files -> Scan... -> select src/main/java/componentscan.xml -> OK -> OK

            Now the Spring Explorer view gets a refresh.

            To my suprise, this list does not include all beans which are part of the spring-social-showcase (e.g. @Bean beans dataSource, facebook, textEncryptor, etc.). Instead the Spring Explorer's beans list includes a handful of @Controller controllers and @Configuration configurations).

            Is it the case that the Spring Explorer view is currently broken with respect to viewing @Bean annotated beans?

            Comment


            • #7
              Hi!

              If the Spring explorer doesn't show the @Bean annotated beans for your case, it sounds like a bug in Spring IDE or STS. Can you please file a JIRA for this:

              https://issuetracker.springsource.com/browse/STS

              and maybe attach a small sample project that reproduces the problem? That would be great!

              Thanks,
              Martin

              Comment


              • #8
                I'd like to file a request. The problem is I only have a vague understanding about STS' features and views. That is, I didn't find any documation explaining what the different Spring views (e.g. "Spring Explorer", "Beans Cross References") are supposed to do and how to work with them.

                Therefore, I cannot say whether what I'm asking for ("Annotation beans don't show up in Spring Explorer") is a feature request or an observed defect, or is actually completely out of place.

                tl;dr: Please provide documentation for STS, explaining what you can do with it.

                Comment


                • #9
                  Hey!

                  Sorry for not getting back to this sooner, it slipped through my to-do list somehow. Sorry for that.
                  We don't have extensive documentation about the IDE features in a written-down format, but you can find a lot of useful information from this collection of "getting started" material:

                  http://forum.springsource.org/showth...etting-Started

                  Hope this helps!
                  -Martin

                  Comment

                  Working...
                  X