JSF,Spring,Hibernate Integration.Showing error in applicationContext.xml - spring

I am trying to integrate JSF,Spring and Hibernate.I created bean id for one class in spring .But applicationContext.xml file showing a ClassNotFound exception for the class in Spring project.

Related

Instantiating Spring boot bean from Spring applicationContext

I am trying to autowire a bean created in spring boot jar in my spring application and when i try to run the app that bean throws error as bean not found. Now since we do not have ComponentScan in spring application, is there any way we can create a bean from spring boot app in classic spring app.

Spring Boot Bean 'Required bean of type that could not be found'

I have been working on learning how to use spring data and I have created a very simple project to test it. The folder structure and applicationcontext.xml is shown here:applicationcontext.xml and folder structure
The error I am getting is shown here:console error output
.
I have the applicationContext on my classpath and have a bean of that class declared, any idea as to what my problem could be ? Thank you.
EDIT:
I have updated my post to show the main class and the dao class, as well as my pom.xml contents (as at this point, I am wondering if I need to include another dependency . . . )
main class
dao (repository)
I miss the following line in your application log:
... o.s.b.f.xml.XmlBeanDefinitionReader : Loading XML bean definitions from class path resource [applicationContext.xml]
So I assume your applicationContext.xml file is not loaded at all.
Either add
#ImportResource("classpath:applicationContext.xml")
to your application class or add the
#Repository
annotation to your UserRepository class.
In my opinion you should avoid mixing Java and XML Spring configuration if possible.

Error when using #StepScope with Spring Batch Admin

I'm using Spring Batch Admin to launch batches from a batch module of my main project.
The batch module compile as a JAR addedstrong text in the dependency of the Spring Batch Admin project as follow:
<dependency>
<groupId>company.project</groupId>
<artifactId>project-batch</artifactId>
<version>1.10.0-SNAPSHOT</version>
</dependency>
Since I added "#StepScope" on one of my reader classes, I get the following error when deploying Spring Batch Admin
Could not generate CGLIB subclass of class [class com.sun.proxy.$Proxy71]: Common causes of this problem include using a final class or a non-visible class; nested exception is java.lang.IllegalArgumentException: Cannot subclass final class class com.sun.proxy.$Proxy71
I had the same error when running my unit test on the batch module (without Spring Batch Admin) but I resolved it using the following bean declaration in my test configuration:
<bean class="org.springframework.batch.core.scope.StepScope">
<property name="autoProxy" value="false" />
</bean>
But I don't find how to use similar declaration to prevent the error in the Spring Batch Admin project.
I tried to add the bean into a configuration on the module side or on the SBA project side but nothing seems to work.
As far as I can see this error not caused by SBA. This is usual attempt of spring to proxify your bean. Please check your class annotated with #StepScope and remove final from class definition and public method definitions.

Not able to get bean when loading application context from jar

I am loading my application context from a jar file. The jar file contains all class files of war that is been created from maven by using attachclasses=true. The war file uses <mvc:annotation-driven /> and <context:component-scan />. The components inside are annotated by #Component,#Service and #Autowired is also used. When I am doing
ApplicationContext applicationContext=new ClassPathXmlApplicationContext("classpath*:web-controller-application.xml");
applicationContext.getBean(AccountServiceImpl.class);
It says no qualified bean of this type is found where as the same works fine as spring mvc web-application.

No matching factory method found: factory method 'aspectOf() when deploy Spring application in Weblogic

Current application works fine in tc-server/Tomcat and Jboss, but when deployed in Websphere (12), I get
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'applicationAspect' defined in
ServletContext resource [/WEB-INF/spring/app-context.xml]: No matching factory method found: factory method 'aspectOf()'
and its merely a bean I defined in the context for the aspect
<bean id="applicationAspect" class="com.my.app.myaspects" factory-method="aspectOf" />
This is all happens when I import and deploy the war file in Weblogic Oracle Enterprise pack for Eclipse.
I didn't change class-loader. just add a class path in in weblogic.xml for JPA purpose
Here I really want to understand why WebLogic behave so differently on Spring aspect, is it because I was deploying in a war file? I doubted.

Resources