All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.persapiens.jsfboot.javaxfaces.JavaxFacesSpringBootAutoConfiguration Maven / Gradle / Ivy

There is a newer version: 1.7.3
Show newest version
package com.github.persapiens.jsfboot.javaxfaces;


import com.github.persapiens.jsfboot.mojarra.MojarraSpringBootAutoConfiguration;
import javax.faces.application.ProjectStage;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.context.embedded.ServletContextInitializer;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties({ JavaxFacesProperties.class })
@ConditionalOnClass(ProjectStage.class)
@AutoConfigureBefore({MojarraSpringBootAutoConfiguration.class})
@ConditionalOnWebApplication
public class JavaxFacesSpringBootAutoConfiguration {

	@Autowired
	private JavaxFacesProperties javaxFacesProperties;
    
    @Bean
    public ServletContextInitializer javaxFacesServletContextInitializer()
    {
        return  new ServletContextInitializer() {
            @Override
            public void onStartup(ServletContext sc) throws ServletException {                
                JavaxFacesServletContextConfigurer.builder()
                    .javaxFacesProperties(javaxFacesProperties)
                    .servletContext(sc)
                    .build()
                    .configure();
            }            
        };
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy