<beans...">
<context:annotation-config />
<context:component-scan base-package="com.mauro" />
<http auto-config='true' >
<intercept-url pattern="/admin**" access="ROLE_USER" />
<intercept-url pattern="/paginaConGrafica**" access="ROLE_USER" />
<form-login login-page="/login"
default-target-url="/paginaConGrafica"
authentication-failure-url="/error-login.html"
login-processing-url="/j_spring_security_check"/>
<logout logout-success-url="/index" />
</http>
<beans:bean id="restAuthenticationProvider"
class="com.mauro.soclib.security.customAuthenticationProvider" autowire="byType">
</beans:bean>
<authentication-manager alias="authenticationManager">
<authentication-provider
ref="restAuthenticationProvider" />
</authentication-manager>
</beans:beans>
servlet
<?xml version="1.0" encoding="UTF-8"?>
<context:annotation-config />
<context:component-scan base-package="com.mauro.soclib" />
<!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".jsp" />
</bean>
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/social_libreria" />
<property name="username" value="root" />
<property name="password" value="1234" />
</bean>
<bean id="UtenteValidator" class="com.mauro.soclib.validator.UtenteFormValidator" />
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="classpath:message" />
<property name="defaultEncoding" value="UTF-8" />
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<!-- Scan for the domain objects with the ORM annotation -->
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
<property name="packagesToScan" value="com.mauro.soclib" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${jdbc.dialect}</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.jdbc.batch_size">0</prop>
</props>
</property>
</bean>
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- one of the properties available; the maximum file size in bytes -->
<property name="maxUploadSize" value="10000000" />
</bean>
<tx:annotation-driven />
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
</beans>
web.xml:
<!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/root-context.xml</param-value>
</context-param>
<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Processes application requests -->
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- link al config file security -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring-security.xml
</param-value>
</context-param>
<!-- Spring Security -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy
</filter-class>
</filter>
<filter>
<filter-name>hibernateFilter</filter-name>
<filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class>
<init-param>
<param-name>sessionFactoryBeanName</param-name>
<param-value>sessionFactory</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- specifiche della servlet -->
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.css</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.gif</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.jpg</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.png</url-pattern>
</servlet-mapping>
将这些条目添加到dispatcher servlet中,
<bean id="utenteDAO" class="path" />
<bean id="utenteDAOImplementation class" class="path" />
它会抛出错误,因为您没有自动连接依赖项
编辑:
@Autowired
@Qualifier("sessionFactory")
public void seSessionFactory(SessionFactory sessionFactory) {
this.setSessionFactory(sessionFactory);
}
还有这个 UnsatisfiedDependencyException:创建名为“Client Service”的bean时出错:通过字段“Client Repository”表示的未满足的依赖关系;嵌套异常为org.springframework.beans.factory.nosuchbeandefinitionexception:没有“com.kopylov.repository.clien
问题内容: 我将所有的XML Spring配置都转换为Java代码配置,但是由于我有一个丑陋的异常,所以我无法运行我的所有测试(它们之前都曾进行过测试): 这是我的测试课: 和我的: 我在测试课上尝试了推子,但这没用。该项目是Spring MVC项目,但是现在我仅测试服务层,所以为什么要在我的课程上放置该注释?即使有了该注释,也会出现另一个错误。那么,这里发生了什么? 问题答案: 您的配置很好,除
问题内容: 我正在使用Springframework和Tomcat创建一个简单的REST服务。响应应该像{“ id”:“ 101”,“ name”:“ Ram”}之类的json中。每次运行时,出现以下错误 从这里开始,以下是我的Java代码和xml文件。 POM.xml web.xml front-controller-servlet.xml json / User.java json / Use
当我尝试启动应用程序时,我得到以下消息: “不满意的依赖关系”异常:创建名称为“产品服务”的 Bean 时出错 [C:\Users\Acasa\0 SDA\0 Proiecte 实践\attentive2细节\目标\类\com\示例\attentive2细节\服务\产品服务.class]:通过构造函数参数 0 表示的不满意的依赖关系;嵌套的异常是组织.springframework.bean.fa
当我试图运行我的项目时,我遇到了以下错误: 这是我的豆子: 我查看了我所有的文件,我自己似乎找不到错误,就像我在标题中所说的,我是初学者,我需要一些帮助。 预期的结果是让它运行,让我能够通过邮递员与它互动
问题内容: 任何建议将不胜感激。我难过… 问题 在我的笔记本电脑上,只要我们的应用程序尝试加载application- config.xml,我都会收到java.lang.reflect.MalformedParameterizedTypeException。 完全相同的代码可在我的台式机和同事的台式机/笔记本电脑上使用。但是在我的笔记本电脑上,它将引发此错误。由于我的笔记本电脑和台式机是完全相同