Announcement Announcement Module
Collapse
No announcement yet.
How does IOS find Server class Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How does IOS find Server class

    Hi,
    I am a absolute beginner.
    I found the following code:

    Code:
    ctx = new AnnotationConfigApplicationContext();
    		ctx.scan("com.foo");
    		
    		ctx.refresh();
    		ctx.registerShutdownHook();
    		
    	org.eclipse.jetty.server.Server server = BeanFactoryUtils.beanOfType(ctx, org.eclipse.jetty.server.Server.class);
    in a package "com.foo.conf" there exists a JettyServerConfig class
    Code:
    @Configuration
    @ImportResource("classpath:META-INF/cxf/cxf.xml")
    public class JettyServerConfig {
    @Bean(destroyMethod = "stop")
    	@Autowired
    	public Server server(ThreadPool threadPool, Connector[] connectors, Handler[] handlers) {
    		Server server = new Server();
    		server.setThreadPool(threadPool);
    		server.setConnectors(connectors);
    		HandlerCollection handler = new HandlerCollection();
    		handler.setHandlers(handlers);
    		server.setHandler(handler);
    		return server;
    	}
    }
    Now package "com.foo" definitely does not contain a org.eclipse.jetty.server.Server class
    So how does Spring find the jetty server and how does Spring know it has to call JettyServerConfig.server?

  • #2
    ha ,
    I think I found the solution.
    there is a class with a @configuration annotation and a method
    @Autowired
    public Server server(...)

    I think this class produces the bean server

    Comment

    Working...
    X