1

I am using Spring 3.1.2 along with javax.inject.jar on the class-path and I get the following message printed to my log files. I get these six lines of output for every web request to the application.

00:53:11,291 INFO  [ClassPathScanningCandidateComponentProvider] JSR-330 'javax.inject.Named' annotation found and supported for component scanning
00:53:11,301 INFO  [ClassPathScanningCandidateComponentProvider] JSR-330 'javax.inject.Named' annotation found and supported for component scanning
00:53:11,309 INFO  [ClassPathScanningCandidateComponentProvider] JSR-330 'javax.inject.Named' annotation found and supported for component scanning
00:53:11,417 INFO  [ClassPathScanningCandidateComponentProvider] JSR-330 'javax.inject.Named' annotation found and supported for component scanning
00:53:11,431 INFO  [ClassPathScanningCandidateComponentProvider] JSR-330 'javax.inject.Named' annotation found and supported for component scanning
00:53:11,455 INFO  [ClassPathScanningCandidateComponentProvider] JSR-330 'javax.inject.Named' annotation found and supported for component scanning

Question:

  • Why is the above message being printed on every request?
  • How to stop it from being printed on every request?

UPDATE: Here is how spring boots up:

<!-- Listeners that startup spring -->
<listener>
     <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
    <listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
</listener>


    <!-- main dispatcher servlet -->
<servlet>
    <servlet-name>main</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>main</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

I am using JRebel and I am not sure if that starts extra contexts as part of its hacking the JVM and libraries to support live reload.

Any debug flags or categories I can configure to figure out where the problem is occurring?

ams
  • 60,316
  • 68
  • 200
  • 288
  • 3
    You should only see that when an application context is being created. Generally it's not a good idea to do that on every web request, so I suspect you might need to look at adopting a more conventional approach to context creation (e.g. once per servlet instance). All the sample apps would do it right. – Dave Syer Nov 30 '12 at 08:13
  • I am not creating a context on every request, I am using a servlet context listener to start spring on web app startup. – ams Nov 30 '12 at 09:52
  • Well it looks like somehow a context is being created. How is your servlet defined? Is it a Spring DispatcherServlet? You are going to have to provide some more detail. – Dave Syer Nov 30 '12 at 09:57
  • Personally I found [this](http://stackoverflow.com/questions/23252743/change-spring-framework-log-level-in-simple-example-project) works like a magic. – Lu Fangjian Jul 25 '14 at 08:45

0 Answers0