求助,整合jersey+spring+jpa+springmvc jersey的scan 扫描无法进入controller

babalaba80 babalaba80 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我现在在整合jersey+spring+jpa+springmvc
jersey的scan 扫描可以进restful 接口可以通过地址栏访问。
springmvc的controller怎样都进不去。看不出原因来。

附上spring-mvc.xml ,applicationContext.xml , web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- 查找最新的schemaLocation 访问 http://www.springframework.org/schema/ -->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">
<!-- 防止@ResponseBody中文乱码 -->
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="messageConverters">
<list>
<bean
class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<bean class="org.springframework.http.MediaType">
<constructor-arg index="0" value="text" />
<constructor-arg index="1" value="plain" />
<constructor-arg index="2" value="UTF-8" />
</bean>
</list>
</property>
</bean>
</list>
</property>
</bean>

<!--<mvc:default-servlet-handler/>-->
<!-- 静态资源文件,不会被Spring MVC拦截 -->
<mvc:resources location="../../resources/spring" mapping="/resources/**"/>
<!-- 启用MVC注解 -->
<mvc:annotation-driven />
<!-- 指定Sping组件扫描的基本包路径 -->
<context:component-scan base-package="org1.coding.demo.springmvc.*" >
<!-- 这里只扫描Controller,不可重复加载Service -->
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>

<!-- JSP视图解析器-->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".jsp" />
<property name="order" value="1" />
</bean>
</beans>


<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd

http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd

http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">

<context:component-scan base-package="org.codingpedia.demo.rest.*" />

<!-- ************ JPA configuration *********** -->
<tx:annotation-driven transaction-manager="transactionManager" />
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<bean id="transactionManagerLegacy" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactoryLegacy" />
</bean>
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceXmlLocation" value="classpath:config/persistence-demo.xml" />
<property name="persistenceUnitName" value="demoRestPersistence" />
<property name="dataSource" ref="restDemoDS" />
<property name="packagesToScan" value="org.codingpedia.demo.*" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="showSql" value="true" />
<property name="databasePlatform" value="org.hibernate.dialect.MySQLDialect" />
</bean>
</property>
</bean>
<bean id="entityManagerFactoryLegacy" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceXmlLocation" value="classpath:config/persistence-demo.xml" />
<property name="persistenceUnitName" value="demoRestPersistenceLegacy" />
<property name="dataSource" ref="restDemoLegacyDS" />
<property name="packagesToScan" value="org.codingpedia.demo.*" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="showSql" value="true" />
<property name="databasePlatform" value="org.hibernate.dialect.MySQLDialect" />
</bean>
</property>
</bean>

<bean id="podcastDao" class="org.codingpedia.demo.rest.dao.PodcastDaoJPA2Impl"/>
<bean id="podcastService" class="org.codingpedia.demo.rest.service.PodcastServiceDbAccessImpl" />
<bean id="podcastsResource" class="org.codingpedia.demo.rest.resource.PodcastsResource" />
<bean id="podcastLegacyResource" class="org.codingpedia.demo.rest.resource.PodcastLegacyResource" />

<bean id="restDemoDS" class="org.springframework.jndi.JndiObjectFactoryBean" scope="singleton">
<property name="jndiName" value="java:comp/env/jdbc/restDemoDB" />
<property name="resourceRef" value="true" />
</bean>
<bean id="restDemoLegacyDS" class="org.springframework.jndi.JndiObjectFactoryBean" scope="singleton">
<property name="jndiName" value="java:comp/env/jdbc/restDemoLegacyDB" />
<property name="resourceRef" value="true" />
</bean>
</beans>


<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name>Demo - Restful Web Application</display-name>
<!-- Spring Application Context Listener Start -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<!-- Spring Application Context Listener End -->

<!-- Spring MVC Config Start -->
<servlet>
<servlet-name>Spring_MVC</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/spring-mvc.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Spring_MVC</servlet-name>
<!-- Filter all resources -->
<url-pattern>/</url-pattern>
</servlet-mapping>
<!-- Spring MVC Config End -->

<!--jersey servlet begin-->
<!--<servlet>-->
<!--<servlet-name>jersey-serlvet</servlet-name>-->
<!--<servlet-class>-->
<!--org.glassfish.jersey.servlet.ServletContainer-->
<!--</servlet-class>-->
<!--<init-param>-->
<!--<param-name>javax.ws.rs.Application</param-name>-->
<!--<param-value>org.codingpedia.demo.rest.RestDemoJaxRsApplication</param-value> -->
<!--</init-param> -->
<!--<load-on-startup>1</load-on-startup>-->
<!--</servlet>-->
<!---->
<!--<servlet-mapping>-->
<!--<servlet-name>jersey-serlvet</servlet-name>-->
<!--<url-pattern>/*</url-pattern>-->
<!--</servlet-mapping>-->
<!--jersey servlet end-->

<resource-ref>
<description>Database resource for rest demo web application </description>
<res-ref-name>jdbc/restDemoDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<description>Database resource for legacy system of demo rest web application </description>
<res-ref-name>jdbc/restDemoLegacyDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

<!-- Spring 编码过滤器 start -->
<filter>
<filter-name>characterEncoding</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>characterEncoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Spring 编码过滤器 End -->
<!-- 隐藏的HttpMethod方法过滤器,表单提交中需要携带一个name=_method的隐藏域,value=put或者delete -->
<filter>
<filter-name>HiddenHttpMethodFilter</filter-name>
<filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>HiddenHttpMethodFilter</filter-name>
<servlet-name>SpringMVC</servlet-name>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
...全文

相关推荐

政府科技管理者如何高效评估科技成果的市场转化潜力?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

BIZKEEN

产业园区运营负责人如何实现园区内创新资源的智能配置?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

BIZKEEN

科技中介服务机构在为中小企业提供技术对接服务时,如何解决信息盲区与匹配低效问题?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

BIZKEEN

电力系统风储联合一次调频仿真模型(Simulink仿真实现)

内容概要:本文提供了“电力系统风储联合一次调频仿真模型”的Simulink仿真实现方案,系统性地构建了风电与储能系统协同参与电力系统一次频率调节的动态仿真模型。该模型深度融合风力发电的波动性特征与储能系统的快速响应能力,设计了联合调频控制策略,通过Simulink平台实现了对电网频率扰动的精细化仿真分析。内容涵盖风储功率协调分配、逆变器控制(如VSG、下垂控制)、中点电位平衡、正负序分离、电网前馈补偿等关键技术模块,重点考察控制逻辑架构、关键参数整定及系统在动态工况下的频率响应性能,旨在验证风储联合系统在提升低惯量电网频率稳定性和调频效能方面的可行性与优越性。; 适合人群:具备电力系统分析、自动控制理论及新能源并网技术基础,熟练掌握Simulink/MATLAB仿真工具,从事电力系统稳定控制、新能源集成、储能应用等方向研究的研究生、科研人员及电力行业工程技术人员。; 使用场景及目标:①深入探究风电与储能系统在电网一次调频中的协同控制机理与能量管理策略;②对比分析不同控制算法(如下垂控制、VSG、MPC等)对频率调节效果的影响;③支撑学术论文复现、科研项目仿真验证及新型电力系统工程方案的前期可行性研究。; 阅读建议:建议结合电力系统频率控制相关经典文献与最新研究成果,逐步调试模型中的控制参数,重点关注风储出力协调性、控制延时、响应速度及弱电网条件对整体调频性能的影响,推荐通过多场景对比仿真以深化对系统动态行为的理解。

荔枝科研社

产业园区如何实现科技资源的统一管理和动态监测?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

BIZKEEN
评论 2
收藏 已收藏
分享
返回顶部
babalaba80
Web 开发 81,108 成员 341,721 内容