Announcement Announcement Module
Collapse
No announcement yet.
spring 3.1: How to set property reference in java config define in xml. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • spring 3.1: How to set property reference in java config define in xml.

    Hi i have some session factory define in xml file.

    I have the following define

    Code:
    <bean id="company.sessionFactory"
    		class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"/>
    inside xml file.

    I want to be able to reference this session factory inside my java config class.

    Code:
    @Override
    	public void addInterceptors(final InterceptorRegistry registry) {
    		// Changes the locale when a 'locale' request parameter is sent; e.g. ?locale=de
    		registry.addInterceptor(new LocaleChangeInterceptor()); 
    		final OpenSessionInViewInterceptor osivInterceptor = new OpenSessionInViewInterceptor();
                     // need to set session factory. 
    	}
    How would i do this?

  • #2
    @Autowire the sessionfactory in your config class and use as desired.

    Comment

    Working...
    X