getting error in project......Here is my code - spring-webflow

It is not identifying the initFlow() method in FlowController
Here is my FlowController
FlowController.java :-
-----------------------------------
package com.niit.shoppingcart;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component;
import com.niit.shoppingcart.dao.BillingAddressDAO;
import com.niit.shoppingcart.dao.CardDetailDAO;
import com.niit.shoppingcart.dao.CartDAO;
import com.niit.shoppingcart.dao.OrderDetailDAO;
import com.niit.shoppingcart.dao.OrderedItemsDAO;
import com.niit.shoppingcart.dao.ProductDAO;
import com.niit.shoppingcart.dao.ShippingAddressDAO;
import com.niit.shoppingcart.dao.UserDetailsDAO;
import com.niit.shoppingcart.model.BillingAddress;
import com.niit.shoppingcart.model.CardDetail;
import com.niit.shoppingcart.model.Cart;
import com.niit.shoppingcart.model.CheckoutDetails;
import com.niit.shoppingcart.model.OrderDetail;
import com.niit.shoppingcart.model.OrderedItems;
import com.niit.shoppingcart.model.Product;
import com.niit.shoppingcart.model.ShippingAddress;
import com.niit.shoppingcart.model.UserDetails;
#Component(value="flowController")
public class FlowController {
#Autowired
private ProductDAO productDAO;
#Autowired
private ShippingAddress shippingAddress;
#Autowired
private BillingAddress billingAddress;
#Autowired
private OrderDetail orderDetail;
#Autowired
private OrderedItems orderedItems;
#Autowired
private CardDetail cardDetail;
#Autowired
private ShippingAddressDAO shippingAddressDAO;
#Autowired
private BillingAddressDAO billingAddressDAO;
#Autowired
private OrderedItemsDAO orderedItemsDAO;
#Autowired
private OrderDetailDAO orderDetailDAO;
#Autowired
private CardDetailDAO cardDetailDAO;
#Autowired
UserDetails userDetails;
#Autowired
UserDetailsDAO userDetailsDAO ;
#Autowired
CartDAO cartDAO;
#Autowired
List<Cart> cart;
#Autowired
HttpSession httpSession;
#Autowired
Product product;
public ShippingAddress initFlow() {
return new ShippingAddress();
}
public String saveDetails(ShippingAddress shippingAddress){
/*Authentication auth = SecurityContextHolder.getContext().getAuthentication();
String name = auth.getName();
UserDetails userDetails=userDetailsDAO.getCustomerByUserName(name);
String loggedInUser = userDetails.getId();
shippingAddress.setUserId(loggedInUser);*/
shippingAddressDAO.saveOrUpdate(shippingAddress);
return "success";
}
public String saveDetails(BillingAddress billingAddress){
/*Authentication auth = SecurityContextHolder.getContext().getAuthentication();
String name = auth.getName();
UserDetails userDetails=userDetailsDAO.getCustomerByUserName(name);
String loggedInUser = userDetails.getId();
billingAddress.setUserId(loggedInUser);*/
billingAddressDAO.saveOrUpdate(billingAddress);
return "success";
}
public String saveDetails(CardDetail cardDetail){
/*Authentication auth = SecurityContextHolder.getContext().getAuthentication();
String name = auth.getName();
UserDetails userDetails=userDetailsDAO.getCustomerByUserName(name);
String loggedInUser = userDetails.getId();
cardDetail.setUserId(loggedInUser);*/
cardDetailDAO.saveOrUpdate(cardDetail);
return "success";
}
/*public String remove(){
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
String name = auth.getName();
UserDetails userDetails=userDetailsDAO.getCustomerByUserName(name);
String loggedInUser = userDetails.getId();
List<Cart> cartList = cartDAO.getByUser(loggedInUser);
if (cartList != null) {
for (int i = 0; i < cartList.size(); i++) {
cartList.get(i).setQuantity(0);
cartDAO.update(cartList.get(i));
}
}
return "success";
}*/
}
===============================================================================
Here is my checkout-flow.xml
checkout-flow.xml :-
----------------------------
<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-2.4.xsd">
<var name="shippingAddress" class="com.niit.shoppingcart.model.ShippingAddress" />
<var name="billingAddress" class="com.niit.shoppingcart.model.BillingAddress" />
<var name="orderedItems" class="com.niit.shoppingcart.model.OrderedItems" />
<var name="orderDetail" class="com.niit.shoppingcart.model.OrderDetail" />
<var name="CardDetail" class="com.niit.shoppingcart.model.CardDetail" />
<var name="cart" class="com.niit.shoppingcart.model.Cart" />
<var name="UserDetails" class="com.niit.shoppingcart.model.UserDetails" />
<var name="checkoutDetails" class="com.niit.shoppingcart.model.CheckoutDetails"></var>
<on-start>
<evaluate expression="flowController.initFlow()" result="flowScope.shippingAddress" />
</on-start>
<view-state id="start" view="shippingAddress" model="flowScope.shippingAddress">
<transition on="submitShippingAddress" to="saveShipping" />
<transition on="back" to="toHome" />
</view-state>
<action-state id="saveShipping">
<evaluate expression="flowController.saveDetails(shippingAddress)"></evaluate>
<transition on="success" to="viewBillingDetails" />
</action-state>
<!-- <action-state id="shippingDetails">
<evaluate
expression="flowController.addShippingAddress(flowScope.checkoutDetails,flowScope.shippingAddress)"></evaluate>
<transition on="success" to="viewBillingDetails" />
<transition on="failure" to="start" />
</action-state> -->
<view-state id="viewBillingDetails" view="billingAddress" model="flowScope.billingAddress">
<transition on="submitBillingAddress" to="saveBilling" />
<transition on="cancel" to="start" />
</view-state>
<action-state id="saveBilling">
<evaluate expression="flowController.saveDetails(billingAddress)"></evaluate>
<transition on="success" to="viewCardDetail" />
</action-state>
<!-- <action-state id="billingDetails">
<evaluate
expression="flowController.addBillingAddress(flowScope.checkoutDetails,billingAddress)"></evaluate>
<transition on="success" to="viewCardDetail" />``
</action-state> -->
<view-state id="viewCardDetail" view="cardDetail"
model="cardDetail">
<transition on="confirmCheckout" to="save" />
<transition on="cancel" to="viewBillingDetails" />
</view-state>
<!-- <action-state id="cardDetail">
<evaluate
expression="flowController.addCardDetails(flowScope.checkoutDetails,cardDetail)"></evaluate>
<transition on="success" to="orderConfirm" />
</action-state> -->
<action-state id="save">
<evaluate expression="flowController.saveDetails(cardDetail)"></evaluate>
<transition on="success" to="orderConfirm" />
</action-state>
<view-state id="orderConfirm" view="orderConfirmed">
<!-- <transition on="finalHome" to="remove" /> -->
<transition on="finalHome" to="toHome" />
</view-state>
<!-- <action-state id="remove">
<evaluate expression="FlowController.remove()"></evaluate>
<transition on="success" to="toHome" />
</action-state> -->
<!-- <end-state id="orderConfirmed" view="orderConfirmed"/>
<end-state id="toCartView" view="externalRedirect:contextRelative:/user/cart/" /> -->
<end-state id="toHome" view="Home" />
<global-transitions>
<transition on="back" to="Home" />
</global-transitions>
</flow>
Here is my dispatcher-servlet.xml, i have given the entries of checkoutDetails....
dispatcher-servlet.xml:-
------------------------------------------------------
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:flow="http://www.springframework.org/schema/webflow-config"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/webflow-config
http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.4.xsd">
<context:component-scan base-package="com.niit.shoppingcart" />
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize" value="200000" />
</bean>
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/view/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
<mvc:resources mapping="/resources/**" location="/resources/" />
<mvc:annotation-driven/>
<!-- Using FlowController instead of FlowHandlers; see SWF Reference Guide, section 9.5. -->
<context:component-scan base-package="com.niit.shoppingcart.*" />
<bean id="flowController" class="org.springframework.webflow.mvc.servlet.FlowController">
<property name="flowExecutor" ref="flowExecutor"/>
</bean>
<flow:flow-executor id="flowExecutor" flow-registry="flowRegistry"/>
<!-- This creates an XmlFlowRegistryFactory bean -->
<flow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices" base-path="/WEB-INF">
<flow:flow-location id="memberShip" path="/memberShipFlow.xml"/>
<flow:flow-location id="checkoutDetails" path="/checkout-flow.xml"/>
</flow:flow-registry>
<flow:flow-builder-services id="flowBuilderServices" view-factory-creator="viewFactoryCreator"/>
<bean id="viewFactoryCreator"
class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator">
<property name="viewResolvers">
<list>
<ref bean="viewResolver" />
</list>
</property>
</bean>
<bean id="viewResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix">
<value>/view/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter">
<property name="flowExecutor" ref="flowExecutor" />
</bean>
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
<property name="flowRegistry" ref="flowRegistry" />
<property name="order" value="0" />
</bean>
</beans>
===============================================================================
Here is my error report:-
Error Report :-
--------------------------------------------------
SEVERE: Servlet.service() for servlet [dispatcher] in context with path [/ShoppingCartFrontEnd] threw exception [Request processing failed; nested exception is org.springframework.webflow.execution.ActionExecutionException: Exception thrown executing [AnnotatedAction#2e7a1b64 targetAction = [EvaluateAction#3bb088b8 expression = flowController.initFlow(), resultExpression = flowScope.shippingAddress], attributes = map[[empty]]] in state 'null' of flow 'checkoutDetails' -- action execution attributes were 'map[[empty]]'] with root cause
org.springframework.expression.spel.SpelEvaluationException: EL1004E:(pos 15): Method call: Method initFlow() cannot be found on org.springframework.webflow.mvc.servlet.FlowController type
at org.springframework.expression.spel.ast.MethodReference.findAccessorForMethod(MethodReference.java:211)
at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:125)
at org.springframework.expression.spel.ast.MethodReference.access$000(MethodReference.java:49)
at org.springframework.expression.spel.ast.MethodReference$MethodValueRef.getValue(MethodReference.java:347)
at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:88)
at org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue(SpelNodeImpl.java:131)
at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:299)
at org.springframework.binding.expression.spel.SpringELExpression.getValue(SpringELExpression.java:84)
at org.springframework.webflow.action.EvaluateAction.doExecute(EvaluateAction.java:75)
at org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188)
at org.springframework.webflow.execution.AnnotatedAction.execute(AnnotatedAction.java:145)
at org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:51)
at org.springframework.webflow.engine.ActionList.execute(ActionList.java:154)
at org.springframework.webflow.engine.Flow.start(Flow.java:526)
at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:368)
at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:223)
at org.springframework.webflow.executor.FlowExecutorImpl.launchExecution(FlowExecutorImpl.java:140)
at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:263)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:522)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:1110)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:785)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1425)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)

The problem may be in your dispatcher-servlet.xml:
<bean id="flowController" class="org.springframework.webflow.mvc.servlet.FlowController">
<property name="flowExecutor" ref="flowExecutor"/>
</bean>
Your FlowController.java file has:
package com.niit.shoppingcart;
At the head, so that would mean that the full name of your bean should be:
<bean id="flowController" class="com.niit.shoppingcart.FlowController">
<property name="flowExecutor" ref="flowExecutor"/>
</bean>
Does that help you?

You have 2 beans named flowController. One of them is a spring bean for your configuration, the other is the bean you use in this order flow.
I suggest you change:
#Component(value="flowController")
to something like:
#Component(value="checkoutFlowController")
and then all references to it in your checkout-flow as well:
<evaluate expression="checkoutFlowController.initFlow()" result="flowScope.shippingAddress" />
etc.

Related

No Persistence provider for EntityManager named?

when I try to create a bean entityManager, I get the error No Persistence provider for EntityManager named DB
My persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
version="2.1">
<persistence-unit name="DB">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/bot" />
<property name="javax.persistence.jdbc.user" value="postgres" />
<property name="javax.persistence.jdbc.password" value="1006" />
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
</properties>
</persistence-unit>
</persistence>
path persistence.xml:
scr
main
java
com.org.ru
META-INF
persistence.xml

Spring mvc how to recover a value from .properties

I work with Spring MVC. I have a dynamic web project.
Project structure is
I have a correos.properties in /WEB-INF/classes.
correos.properties is
correosalida = xxx
I want to get a property from correos.properties
dispatcher is
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.jasypt.org/schema/encryption
http://www.jasypt.org/schema/encryption/jasypt-spring31-encryption-1.xsd">
<context:annotation-config />
<import resource="hibernate-context.xml" />
<context:component-scan base-package="eusurvey" />
<bean id="propertyPlaceholderConfigurer"
class="org.jasypt.spring31.properties.EncryptablePropertyPlaceholderConfigurer">
<constructor-arg ref="configurationEncryptor" />
<property name="location" value="/WEB-INF/spring.properties" />
</bean>
<bean id="configurationEncryptor" class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor">
<property name="config" ref="environmentVariablesConfiguration" />
</bean>
<bean id="environmentVariablesConfiguration"
class="org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig">
<property name="algorithm" value="PBEWITHSHA256AND256BITAES-CBC-BC" />
<property name="passwordEnvName" value="CAS_PBE_PASSWORD" />
<property name="providerClassName"
value="org.bouncycastle.jce.provider.BouncyCastleProvider" />
<property name="providerName" value="BC" />
</bean>
<mvc:annotation-driven />
<mvc:view-controller path="encuesta/*"
view-name="encuesta/actualizarCorreoC.jsp" />
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="WEB-INF/classes/messages" />
</bean>
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
<mvc:resources mapping="/resources/**" location="/resources/" />
<context:property-placeholder location="WEB-INF/classes/correos.properties" order="1" ignore-unresolvable="true" />
</beans>
LeerProperties.java is
package eusurvey.auxiliar;
import org.springframework.beans.factory.annotation.Value;
public class LeerProperties {
#Value("${correos.correosalida}")
private String correosalida;
public String PropertyValue() {
return correosalida;
}
}
Value of correosalida is null.
How can I get a property from correos.properties?
Did you try to reach the file using classpath?
It should be like this:
<context:property-placeholder location="classpath:correos.properties" order="1" ignore-unresolvable="true" />
EDIT:
Try to load this way:
<util:properties id="correos" location="classpath:correos.properties"/>
And shouldn't be with a "#" instead of a "$"?
#Value("#{correos.correosalida}")

sec:authorize doesn't work

Recently I have started a new project and decided to use the latest versions of spring, spring security and thymeleaf
I have included these packets
def springVersion = '4.1.6.RELEASE'
def securityVersion = '4.0.1.RELEASE'
def thymeleafVersion = '2.1.2.RELEASE'
compile "org.springframework:spring-core:$springVersion"
compile "org.springframework:spring-webmvc:$springVersion"
compile "org.springframework.security:spring-security-web:$securityVersion"
compile "org.springframework.security:spring-security-config:$securityVersion"
compile "org.thymeleaf:thymeleaf-spring4:$thymeleafVersion"
compile "org.thymeleaf.extras:thymeleaf-extras-springsecurity4:$thymeleafVersion"
I have added #EnableWebSecurity and #Bean SpringSecurityDialect to my configuration.
In the layout.html I have
<ul class="nav navbar-nav navbar-right">
<li sec:authorize="isAnonymous()"><a th:href="#{/login}">Login</a></li>
<li sec:authorize="isAuthenticated()"><a th:href="#{/logout}">Logout</a></li>
</ul>
<br>
Neither of the options show up. Moreover, when I replace those calls with true that doesn't change anything. And I don't see any error messages when make an error in function name like isAnon().
Am I missing something?
UPD
Security config
#Configuration
#EnableWebSecurity
#EnableGlobalMethodSecurity(prePostEnabled=true)
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
#Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("admin").password("admin").roles("ADMIN");
}
#Override
protected void configure(HttpSecurity http) throws Exception {
http
.csrf().disable()
.formLogin()
.loginPage("/login")
.failureUrl("/login-error")
.and()
.logout()
.logoutSuccessUrl("/")
.logoutRequestMatcher(new AntPathRequestMatcher("/logout"));
}
}
Web config
#Configuration
#EnableWebMvc
#ComponentScan(basePackages = {"stats.web.controller","stats.web.domain","stats.mapper", "stats.core.service;"})
#Import({ WebSecurityConfig.class })
public class WebConfig extends WebMvcConfigurerAdapter {
#Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
}
#Override
public void addInterceptors(InterceptorRegistry registry) {
LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor();
localeChangeInterceptor.setParamName("lang");
registry.addInterceptor(localeChangeInterceptor);
}
#Bean
public LocaleResolver localeResolver() {
CookieLocaleResolver cookieLocaleResolver = new CookieLocaleResolver();
cookieLocaleResolver.setDefaultLocale(StringUtils.parseLocaleString("en"));
return cookieLocaleResolver;
}
#Bean
public ServletContextTemplateResolver templateResolver() {
ServletContextTemplateResolver resolver = new ServletContextTemplateResolver();
resolver.setPrefix("/WEB-INF/views/");
resolver.setSuffix(".html");
resolver.setTemplateMode("HTML5");
resolver.setCacheable(false);
resolver.setCharacterEncoding("UTF-8");
return resolver;
}
public SpringTemplateEngine templateEngine() {
SpringTemplateEngine engine = new SpringTemplateEngine();
engine.addDialect(securityDialect());
engine.setTemplateResolver(templateResolver());
return engine;
}
#Bean
public SpringSecurityDialect securityDialect() {
return new SpringSecurityDialect();
}
#Bean
public ViewResolver viewResolver() {
ThymeleafViewResolver viewResolver = new ThymeleafViewResolver();
viewResolver.setTemplateEngine(templateEngine());
viewResolver.setOrder(1);
viewResolver.setViewNames(new String[]{"*"});
viewResolver.setCache(false);
viewResolver.setCharacterEncoding("UTF-8");
return viewResolver;
}
#Bean
public MessageSource messageSource() {
ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
messageSource.setBasenames("classpath:messages/messages", "classpath:messages/validation");
messageSource.setUseCodeAsDefaultMessage(true);
messageSource.setDefaultEncoding("UTF-8");
messageSource.setCacheSeconds(0);
return messageSource;
}
}
Not sure what bootstrap classes are needed, but I've inspected the page, the second ul that supposed to have login link is empty:
<ul class="nav navbar-nav">
::before
<li>...</li>
<li>...</li>
<li>...</li>
::after
</ul>
<ul class="nav navbar-nav navbar-right">
::before
::after
</ul>
Here is the XML config as I said. Kindly remove the files which you have, annotate your methods to #Service, #Repository for DAO, #Controller for Controller and #Entity for model. PLease dont forget #Transactional. I am authenticating against a DB in postgreSQL, but you can change the dialect.
web.xml :
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"
>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/root-context.xml,/WEB-INF/spring/appServlet/security-applicationContext.xml</param-value>
</context-param>
<session-config>
<session-timeout>1440</session-timeout>
</session-config>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<async-supported>true</async-supported>
<init-param>
<param-name>contextAttribute</param-name>
<param-value>org.springframework.web.context.WebApplicationContext.ROOT</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>403Jsp</servlet-name>
<jsp-file>/WEB-INF/views/error/403.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>403Jsp</servlet-name>
<url-pattern>/403</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
</listener>
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
<async-supported>true</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.png</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.jpg</url-pattern>
</servlet-mapping>
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
Servlet-context.xml :
<security:global-method-security
secured-annotations="enabled"
jsr250-annotations="disabled"
pre-post-annotations="enabled"/>
<context:component-scan base-package="com.journaldev.spring" use-default-filters="false">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller" />
</context:component-scan>
<context:property-placeholder location="classpath:application.properties"/>
<mvc:annotation-driven>
<mvc:argument-resolvers>
<beans:bean class="org.springframework.mobile.device.DeviceWebArgumentResolver"/>
</mvc:argument-resolvers>
</mvc:annotation-driven>
<mvc:interceptors>
<beans:bean class="org.springframework.mobile.device.DeviceResolverHandlerInterceptor"/>
<beans:ref bean="localeChangeInterceptor" />
</mvc:interceptors>
<mvc:default-servlet-handler/>
<resources mapping="/resources/" location="/resources/"/>
<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="prefix" value="/WEB-INF/views/"/>
<beans:property name="suffix" value=".jsp"/>
</beans:bean>
<!-- If you have locale and all, then you need code below -->
<!-- locale -->
<beans:bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<beans:property name="basename" value="classpath:/locale/messages"/>
<beans:property name="defaultEncoding" value="UTF-8"/>
</beans:bean>
<!-- default locale -->
<beans:bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
<beans:property name="defaultLocale" value="de"/>
</beans:bean>
<!-- Change locale via url. -->
<beans:bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<beans:property name="paramName" value="lang"/>
</beans:bean>
<beans:bean id="handlerMapping" class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping">
<beans:property name="interceptors">
<beans:list>
<beans:ref bean="localeChangeInterceptor"/>
</beans:list>
</beans:property>
</beans:bean>
</beans:beans>
root-context.xml :
<context:component-scan base-package="com.journaldev.spring">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" />
</context:component-scan>
<context:property-placeholder location="classpath:application.properties"/>
<beans:bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<beans:property name="driverClassName" value="org.postgresql.Driver"/>
<beans:property name="url"
value="jdbc:postgresql://localhost:5432/dbname"/>
<beans:property name="username" value="postgres"/>
<beans:property name="password" value="dbpass"/>
<beans:property name="removeAbandoned" value="true"/>
<beans:property name="removeAbandonedTimeout" value="20"/>
<beans:property name="defaultAutoCommit" value="false"/>
</beans:bean>
<!-- Hibernate 4 SessionFactory Bean definition -->
<beans:bean id="hibernate4AnnotatedSessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<beans:property name="dataSource" ref="dataSource"/>
<beans:property name="packagesToScan" value="com.journaldev.spring.model" />
<beans:property name="hibernateProperties">
<beans:props>
<beans:prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQL9Dialect</beans:prop>
<beans:prop key="hibernate.show_sql">false</beans:prop>
<!-- <beans:prop key="hibernate.jdbc.batch_size">1000</beans:prop>
<beans:prop key="hibernate.order_updates">true</beans:prop>-->
<beans:prop key="hibernate.hbm2ddl.auto">update</beans:prop>
</beans:props>
</beans:property>
</beans:bean>
<beans:bean id="LoginServiceImpl" class="com.journaldev.spring.service.LoginServiceImpl"/>
<task:annotation-driven/>
<tx:annotation-driven transaction-manager="transactionManager"/>
<beans:bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<beans:property name="sessionFactory" ref="hibernate4AnnotatedSessionFactory"/>
</beans:bean>
</beans:beans>
security-applicationContext.xml :
<security:http pattern="/resources/**" security="none"/>
<security:http create-session="ifRequired" use-expressions="true" auto-config="false" disable-url-rewriting="true">
<security:form-login login-page="/login" login-processing-url="/j_spring_security_check" default-target-url="/dashboard" always-use-default-target="false" authentication-failure-url="/denied" />
<security:remember-me key="_spring_security_remember_me" user-service-ref="userDetailsService" token-validity-seconds="1209600" data-source-ref="dataSource"/>
<security:logout delete-cookies="JSESSIONID" invalidate-session="true" logout-url="/j_spring_security_logout"/>
<security:port-mappings>
<security:port-mapping http="80" https="443"/>
</security:port-mappings>
<security:logout logout-url="/logout" logout-success-url="/" success-handler-ref="myLogoutHandler"/>
<security:session-management session-fixation-protection="migrateSession">
<security:concurrency-control session-registry-ref="sessionRegistry" max-sessions="5" expired-url="/login"/>
</security:session-management>
</security:http>
<!-- Rest authentication, don't edit, delete, add-->
<bean id="springSecurityFilterChain" class="org.springframework.security.web.FilterChainProxy">
<security:filter-chain-map path-type="ant">
<security:filter-chain filters="persistencefilter,authenticationfilter" pattern="/login"/>
<security:filter-chain filters="persistencefilter,logoutfilter" pattern="/logout"/>
<security:filter-chain pattern="/rest/**" filters="persistencefilter,restfilter" />
</security:filter-chain-map>
</bean>
<bean id="persistencefilter" class="org.springframework.security.web.context.SecurityContextPersistenceFilter"/>
<bean id="authenticationfilter" class="com.journaldev.spring.utility.AuthenticationFilter">
<property name="authenticationManager" ref="authenticationManager"/>
<property name="authenticationSuccessHandler" ref="myAuthSuccessHandler"/>
<property name="passwordParameter" value="pass"/>
<property name="usernameParameter" value="user"/>
<property name="postOnly" value="false"/>
</bean>
<bean id="myAuthSuccessHandler" class="com.journaldev.spring.utility.AuthenticationSuccessHandler"/>
<bean id="myLogoutHandler" class="com.journaldev.spring.utility.MyLogoutHandler"/>
<bean id="logoutfilter" class="org.springframework.security.web.authentication.logout.LogoutFilter">
<constructor-arg index="0" value="/"/>
<constructor-arg index="1">
<list>
<bean class="org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler">
<property name="invalidateHttpSession" value="true"/>
<property name="clearAuthentication" value="true"/>
</bean>
<bean id="myLogoutHandler" class="com.journaldev.spring.utility.MyLogoutHandler"/>
</list>
</constructor-arg>
</bean>
<bean id="httpRequestAccessDecisionManager" class="org.springframework.security.access.vote.AffirmativeBased">
<property name="allowIfAllAbstainDecisions" value="false"/>
<property name="decisionVoters">
<list>
<ref bean="roleVoter"/>
</list>
</property>
</bean>
<bean id="roleVoter" class="org.springframework.security.access.vote.RoleVoter"/>
<bean id="restfilter" class="org.springframework.security.web.access.intercept.FilterSecurityInterceptor">
<property name="authenticationManager" ref="authenticationManager"/>
<property name="accessDecisionManager" ref="httpRequestAccessDecisionManager"/>
<property name="securityMetadataSource">
<security:filter-invocation-definition-source>
<security:intercept-url pattern="/rest/**" access="ROLE_USER"/>
</security:filter-invocation-definition-source>
</property>
</bean>
<!-- Rest authentication ends here-->
<!-- queries to be run on data -->
<beans:bean id="rememberMeAuthenticationProvider" class="org.springframework.security.web.authentication.rememberme.PersistentTokenBasedRememberMeServices">
<beans:property name="key" value="_spring_security_remember_me" />
<property name="alwaysRemember" value="true"/>
<beans:property name="tokenRepository" ref="jdbcTokenRepository"/>
<beans:property name="userDetailsService" ref="LoginServiceImpl"/>
</beans:bean>
<!--Database management for remember-me -->
<beans:bean id="jdbcTokenRepository"
class="org.springframework.security.web.authentication.rememberme.JdbcTokenRepositoryImpl">
<beans:property name="createTableOnStartup" value="false"/>
<beans:property name="dataSource" ref="dataSource" />
</beans:bean>
<!-- Remember me ends here -->
<security:authentication-manager alias="authenticationManager">
<security:authentication-provider user-service-ref="LoginServiceImpl">
<security:password-encoder ref="encoder"/>
</security:authentication-provider>
</security:authentication-manager>
<beans:bean id="encoder"
class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder">
<beans:constructor-arg name="strength" value="11" />
</beans:bean>
<beans:bean id="daoAuthenticationProvider"
class="org.springframework.security.authentication.dao.DaoAuthenticationProvider">
<beans:property name="userDetailsService" ref="LoginServiceImpl"/>
<beans:property name="passwordEncoder" ref="encoder"/>
</beans:bean>
</beans>
For your reference : The only bean LoginServiceImpl bean I have explicitly declared for login :
#Transactional
#Service("userDetailsService")
public class LoginServiceImpl implements UserDetailsService{
#Autowired private PersonDAO personDAO;
#Autowired private Assembler assembler;
#Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException,DataAccessException {
Person person = personDAO.findPersonByUsername(username.toLowerCase());
if(person == null) { throw new UsernameNotFoundException("Wrong username or password");}
return assembler.buildUserFromUserEntity(person);
}
public LoginServiceImpl() {
}
}
To use my code, you need to add the xml files, I hope you can add the schema mappings on your own, if not, I will paste them. When you are done creating and adding code in XML files, please correct package name to LoginServiceImpl, and in web.xml, point the security-applicationContext.xml and root-context.xml correctly.
Any helpp you need lemme know. And the above configuration is tweaked by M.Denium, so incase I am not there on weekend as I am travelling and he is free, he can help you. Have fun. :-)
It might help to compare your configuration with Spring Boot autoconfiguration for Thymeleaf.
Also, I vaguely remember having similar issue that I resolved by moving sec:authorize in <ul> (instead of <li>). It's been a while, so I don't remember the reason I moved it like that. (Sorry!) Here's a sample of what worked for me (although it was with org.thymeleaf.extras:thymeleaf-extras-springsecurity3).
<ul sec:authorize="isAuthenticated()">
<li><p><span sec:authentication="name">test</span></p> </li>
<li>Logout </li>
</ul>
<ul sec:authorize="isAnonymous()">
<li>Sign Up </li>
<li>Login </li>
</ul>
Finally, I have found the difference with my working spring 3 project. It wasn't the spring version, it was this missing class
public class SpringSecurityInitializer extends
AbstractSecurityWebApplicationInitializer {
}
After I added it the "sec" attributes works correctly.

Issue tiles (Could not resolve view with name...)

I am working with Spring MVC. My application was ok before inserting tiles, now I keep receiving the error message as:
javax.servlet.ServletException: Could not resolve view with name '/sisStudent' in servlet with name 'mvc-dispatcher'
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1190)
org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:992)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:939)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
My tiles.xml is:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN"
"http://tiles.apache.org/dtds/tiles-config_3_0.dtd">
<tiles-definitions>
<definition name="base.definition" template="/WEB-INF/jsp/layout.jsp">
<put-attribute name="title" value="" />
<put-attribute name="header" value="/WEB-INF/jsps/header.jsp" />
<put-attribute name="menu" value="/WEB-INF/jsps/menu.jsp" />
<put-attribute name="body" value="" />
<!-- put-attribute name="footer" value="/WEB-INF/jsps/footer.jsp" /> -->
</definition>
<definition name="sisStudent" extends="base.definition">
<put-attribute name="title" value="SIS Students" />
<put-attribute name="body" value="/WEB-INF/jsps/sisStudent.jsp" />
</definition>
</tiles-definitions>
My spring-servlet.xml is:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="au.edu.nsw.det.tls.tar.sis.controller" />
<!--
bean id="tilesViewResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">
property name="prefix"> <value>/WEB-INF/jsps/</value> </property>
<property name="suffix"> <value>.jsp</value> </property> <property
name="viewClass"> <value>
org.springframework.web.servlet.view.tiles3.TilesView</value>
</property> </bean>
-->
<!-- bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/jsps/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean -->
<bean id="viewResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass">
<value> org.springframework.web.servlet.view.tiles3.TilesView</value>
</property>
</bean>
<bean id="tilesConfigurer"
class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/tiles.xml</value>
</list>
</property>
</bean>
</beans>
My controller is:
#Controller
// #RequestMapping("/studentSearch")
public class StudentSearchController {
#Autowired
StudentService studentService;
// #RequestMapping(value="/StudentSearchById", method = RequestMethod.GET)
// public ModelAndView searchById(#PathVariable Long studentId) {
#RequestMapping (value="/openStudentSearchScreen", method = RequestMethod.GET)
public ModelAndView openCourseSearchScreen(){
ModelAndView modelAndView = new ModelAndView("/sisStudent");
return modelAndView;
}
}
Any ideas?
Thank you in advance!
In your ModelAndView constructor remove the leading / so it should be
#RequestMapping (value="/openStudentSearchScreen", method = RequestMethod.GET)
public ModelAndView openCourseSearchScreen(){
ModelAndView modelAndView = new ModelAndView("sisStudent");
return modelAndView;
}
OTOH Insted of ModelAndView you can use String
#RequestMapping (value="/openStudentSearchScreen", method = RequestMethod.GET)
public String openCourseSearchScreen(){
return "sisStudent";//Tiles definition name
}
If you want to add some model attribute
#RequestMapping (value="/openStudentSearchScreen", method = RequestMethod.GET)
public String openCourseSearchScreen(Model model){
model.addAttribute("<name of the attribute>",<value as object>);
return "sisStudent";//Tiles definition name
}

How can a Spring Webflow application be configured to use Xslt to render its viewstates

I would like my Spring Webflow app to render its views using XSLT. I managed to get a pure Spring MVC app to render with xslt by configuring an XSLTviewresolver and a controller method that returned an already prepared xml as a source.
But I'm not sure how to apply that to the webflow app.
I've added the configuration for the XSLT view resolver and set the view state to the xsl, then I call the controller method that returns the xml source in the on-render of the view state.So far I only get the xsl back as the output and not the transformed xml or even the raw xml.
EDIT
flow.xml-full
<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
<view-state id="messageChoice" view="start1">
<transition on="chooseA" to="messageA"/>
<transition on="chooseB" to="messageB"/>
</view-state>
<view-state id="messageA" view="messageA">
<transition on="start" to="messageChoice"/>
</view-state>
<view-state id="messageB" view="xsltview">
<on-render>
<evaluate expression="sampleController.viewXSLT(externalContext.getNativeRequest(),externalContext.getNativeResponse())" result="requestScope.xmlSource"/>
</on-render>
<transition on="start" to="messageChoice"/>
</view-state>
<end-state id="finish"/>
</flow>
controller-snippet
#RequestMapping(value="/viewxslt")
public ModelAndView viewXSLT(HttpServletRequest request,
HttpServletResponse response) throws IOException {
// builds absolute path of the XML file
String xmlFile = "/WEB-INF/xml/thexml.xml";
String contextPath = request.getSession().getServletContext().getRealPath(xmlFile);
String xmlFilePath = ""+contextPath + File.separator + xmlFile;
Source source = new StreamSource(new File(contextPath));
// adds the XML source file to the model so the XsltView can detect
ModelAndView model = new ModelAndView("xsltview");
model.addObject("xmlSource", source);
return model;
}
EDIT
flow-config-full
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
<context:annotation-config />
<context:component-scan base-package="com.genkey.derek" />
<mvc:view-controller path="/start" />
<mvc:view-controller path="/messageHome" />
<mvc:resources location="/" mapping="/resources/**" />
<faces:resources />
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
<property name="flowRegistry" ref="flowRegistry" />
<property name="order" value="3" />
</bean>
<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"/>
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"/>
<bean id="xsltviewresolver" class="org.springframework.web.servlet.view.xslt.XsltViewResolver">
<property name="order" value="1"/>
<property name="sourceKey" value="xmlSource"/>
<property name="viewClass" value="org.springframework.web.servlet.view.xslt.XsltView"/>
<property name="viewNames">
<array>
<value>xsltview</value>
</array>
</property>
<property name="prefix" value="/WEB-INF/xsl/" />
<property name="suffix" value=".xsl" />
</bean>
<bean id="viewFactoryCreator" class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator">
<property name="viewResolvers">
<list>
<ref bean="xsltviewresolver"/>
<ref bean="faceletsViewResolver" />
</list>
</property>
</bean>
<bean id="faceletsViewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.faces.mvc.JsfView"/>
<property name="prefix" value="/WEB-INF/pages/" />
<property name="suffix" value=".xhtml" />
<property name="order">
<value>2</value>
</property>
</bean>
<bean class="org.springframework.faces.webflow.JsfFlowHandlerAdapter">
<property name="flowExecutor" ref="flowExecutor" />
</bean>
<webflow:flow-executor id="flowExecutor">
<webflow:flow-execution-listeners>
<webflow:listener ref="facesContextListener"/>
</webflow:flow-execution-listeners>
</webflow:flow-executor>
<webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices" >
<webflow:flow-location path="WEB-INF/flows/startFlow.xml"/>
</webflow:flow-registry>
<faces:flow-builder-services id="flowBuilderServices" view-factory-creator="viewFactoryCreator" development="true" />
<bean id="facesContextListener" class="org.springframework.faces.webflow.FlowFacesContextLifecycleListener"/>
</beans>

Resources