Hello:
Let's talk about this issue.
Both ConnectController and ProviderSignInController implement the InitializingBean, which make the configuration likes this would occur NullPointerException:
@Bean
public ConnectController connectController(
ConnectionFactoryLocator connectionFactoryLocator,
ConnectionRepository connectionRepository) throws Exception {
ConnectController conn = new ConnectController(connectionFactoryLocator, connectionRepository);
conn.setApplicationUrl("github.com");
return conn;
}
Even invoked afterPropertiesSet() before setting application url, spring framework would autoinvoke afterPropertiesSet() one more time and clean up the properties of ConnectSupport instance:
@Bean
public ConnectController connectController(
ConnectionFactoryLocator connectionFactoryLocator,
ConnectionRepository connectionRepository) throws Exception {
ConnectController conn = new ConnectController(connectionFactoryLocator, connectionRepository);
conn.afterPropertiesSet();
conn.setApplicationUrl("github.com");
return conn;
}
Hello: Let's talk about this issue. Both ConnectController and ProviderSignInController implement the InitializingBean, which make the configuration likes this would occur NullPointerException: @Bean public ConnectController connectController( ConnectionFactoryLocator connectionFactoryLocator, ConnectionRepository connectionRepository) throws Exception { ConnectController conn = new ConnectController(connectionFactoryLocator, connectionRepository); conn.setApplicationUrl("github.com"); return conn; }
Even invoked afterPropertiesSet() before setting application url, spring framework would autoinvoke afterPropertiesSet() one more time and clean up the properties of ConnectSupport instance: @Bean public ConnectController connectController( ConnectionFactoryLocator connectionFactoryLocator, ConnectionRepository connectionRepository) throws Exception { ConnectController conn = new ConnectController(connectionFactoryLocator, connectionRepository); conn.afterPropertiesSet(); conn.setApplicationUrl("github.com"); return conn; }
Maybe there are other ways to customize my appilcaiton url, but I could not find out. I checked this issue on stackoverflow, only found more similiar questions without the answer, such as: http://stackoverflow.com/questions/25626064/nullpointer-bug-in-spring-social-connectcontroller-configuration