Quantcast
Viewing all articles
Browse latest Browse all 34

Answer by Kunal for Spring MVC read property file null in DAOImpl

My Problem was that since i called a method it wouldn't load the @Value so i had to inject some beans.Like this:

<bean        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"><property name="locations"><list><value>classpath:config.properties</value>            </list></property></bean><bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"><property name="staticMethod" value="com.setelog.spring.dao.UserDetailsDaoImpl.setEmails_Blocked"/><property name="arguments"><list><value>${emails_blocked}</value></list></property></bean>

my UserDetailsDaoImpl:

static String emails_blocked;public static void setEmails_Blocked(String emails_blocked){    UserDetailsDaoImpl.emails_blocked= emails_blocked;}

This Answer helped me a lot:https://stackoverflow.com/a/24649692/4790786


Viewing all articles
Browse latest Browse all 34

Trending Articles