I have an xml configuration
of spring as below:
<bean id="processor"
class="org.springframework.security.saml.processor.SAMLProcessorImpl">
<constructor-arg>
<list>
<ref bean="redirectBinding" />
<ref bean="postBinding" />
<ref bean="artifactBinding" />
<ref bean="soapBinding" />
<ref bean="paosBinding" />
</list>
</constructor-arg>
</bean>
I also have another Java Configuration of Spring as below:
@ImportResource({ "classpath:security/samlMetadata.xml" })
@Configuration
public class SecConfig{
@Autowired
private SAMLProcessorImpl processor;
@Bean(name ="webSSOProfileConsumer")
public WebSSOProfileConsumer webSSOProfileConsumer(){
WebSSOProfileConsumerImpl webSSOProfileConsumerImpl = new WebSSOProfileConsumerImpl();
try {
webSSOProfileConsumerImpl.setProcessor(processor);
webSSOProfileConsumerImpl.afterPropertiesSet();
}
catch (Exception e) {
e.printStackTrace();
}
return webSSOProfileConsumerImpl;
}
}
I get the processor
bean as null, please help me if I am missing some basic thing while autowiring.
EDIT
Here is the relevant part of web.xml
The only thing I am skipping is welcome-file-list
<context-param>
<param-name>contextClass</param-name>
<param-value>
org.springframework.web.context.support.AnnotationConfigWebApplicationContext
</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>com.config.WebConfig
</param-value>
</context-param>
<context-param>
<param-name>spring.profiles.active</param-name>
<param-value>production</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>security</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<init-param>
<param-name>contextClass</param-name>
<param-value>
org.springframework.web.context.support.AnnotationConfigWebApplicationContext
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>security</servlet-name>
<url-pattern>/api/*</url-pattern>
</servlet-mapping>
<filter>
<filter-name>filterChainProxy</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>filterChainProxy</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
EDIT2
@Configuration
@ImportResource({ "classpath:security/samlMetadata.xml" })
@Import({SecureConfig.class})
@Profile("production")
@ComponentScan(basePackages = "com.config")
public class WebConfig extends WebMvcConfigurationSupport {
@Bean(name = "viewResolver")
public InternalResourceViewResolver viewResolver() throws Exception {
InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
viewResolver.setPrefix("/jsp/");
viewResolver.setSuffix(".jsp");
return viewResolver;
}
}
I am sorry I didn't add this class earlier.