In Spring, there are three ways to inject value into bean properties. Normal way Shortcut “p” schema See a simple Java class, which contains two properties – name and type. Later you will use Spring to inject value into the bean properties. package com.mkyong.common; public class FileNameGenerator { private String name; private String type; public […]

Read more How to inject value into bean properties in Spring

Problem In a large project structure, the Spring’s bean configuration files are located in different folders for easy maintainability and modular. For example, Spring-Common.xml in common folder, Spring-Connection.xml in connection folder, Spring-ModuleA.xml in ModuleA folder…and etc. You may load multiple Spring bean configuration files in the code : ApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"Spring-Common.xml", […]

Read more How to load multiple Spring bean configuration file

Problem The Spring AOP transaction is not working in following interceptors? <bean id="testAutoProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"> <property name="interceptorNames"> <list> <idref bean="urlInterceptorInsert" /> <idref bean="urlInterceptorCommit" /> <idref bean="urlInterceptorRelease" /> <idref bean="matchGenericTxInterceptor" /> </list> </property> <property name="beanNames"> <list> <idref local="urlBo" /> </list> </property> </bean> The “matchGenericTxInterceptor” transaction interceptor, suppose to intercept urlInterceptorInsert, urlInterceptorCommit,urlInterceptorRelease, but it’s not work as expected? […]

Read more Spring AOP Interceptor transaction is not working