我正在使用Spring MVC和Virgo Webserver在OSGi应用程序上开发一个模块.
在我的模块上,我有一个Controller,它可以访问Manager,它有一个负责处理报告生成的处理程序列表.
一切都很好,直到我不得不从外部服务调用事务方法.由于我的所有类都不是事务性的,因此我必须将引用添加到转换管理器和annotation-driven.然后,我的经理停止接到通知.
我知道当使用annotation-driven我的所有bean时必须实现一个公共接口,以便代理机制能够工作.据我所知,所有课程都是(其中一个不是,但后来我改了).
我的配置文件是:
束-context.xml中:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
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-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<context:annotation-config />
<tx:annotation-driven transaction-manager="transactionManager"/>
<bean id="reportManager" class="reportmodule.manager.impl.ReportManagerImpl"/>
<bean id="mvpepReportHandler" class="reportmodule.manager.impl.MVPEPReportHandler"/>
<bean id="reportConfigDao" class="reportmodule.repository.impl.ReportConfigurationHibernateDAOImpl"/>
<bean id="oSGIChangeReportHandler" class="reportmodule.osgi.impl.OSGIChangeReportHandlerImpl"/>
<bean id="reportController"
class="reportmodule.controller.impl.ReportControllerImpl"/>
<bean id="reportControllerHandlerMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<value>/module/reportController/**=reportController</value>
</property>
<property name="alwaysUseFullPath" value="true"></property>
</bean>
</beans>
Run Code Online (Sandbox Code Playgroud)
我的bundle-osgi.xml如下:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:osgi="http://www.springframework.org/schema/osgi"
xmlns:osgi-compendium="http://www.springframework.org/schema/osgi-compendium"
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-3.0.xsd
http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi.xsd
http://www.springframework.org/schema/osgi-compendium
http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium-1.2.xsd">
<osgi:reference id="transactionManager" interface="org.springframework.transaction.PlatformTransactionManager" />
<osgi:reference …Run Code Online (Sandbox Code Playgroud) 因此,我有一个Django-REST Framework项目,有一天它只是停止了在PyCharm中运行测试的能力。
从命令行,我可以使用paver或manage.py直接运行它们。
有时会发生这种情况,即我们没有在文件顶部导入类的超类,但事实并非如此。
我们在virtualenv本地设置了一个,然后从一个无聊的盒子中运行服务器。我确保已加载虚拟环境,并且项目的解释器正在使用上述虚拟环境。
没什么事的任何线索。
我一直在尝试编写一个简单的bash脚本作为pre-push钩子,我在推送Java代码时会检查缺少的测试文件.
问题是:read命令没有等待用户输入,它就像没有输入输入一样继续.
has_java="git diff --stat --cached origin/master | grep \"src\/main.*\.java\""
has_test="git diff --stat --cached origin/master | grep \"src\/test.*\.java\""
exit_val=0
if eval $has_java; then
if eval $has_test; then
:
else
echo "*** NO TESTS WERE FOUND WHILE PUSHING JAVA CODE ***"
read -n1 -p "Do you want to CONTINUE pushing? [Y/n]" doit
case $doit in
n|N) exit_val=1 ;;
y|Y) exit_val=0 ;;
*) exit_val=0 ;;
esac
fi
fi
Run Code Online (Sandbox Code Playgroud) 不要误会我的意思,virtualenv(或 pyenv)是一个很棒的工具,虚拟环境的整个概念是对开发人员环境的巨大改进,减轻了整个Snowflake Server反模式。
但是现在 Docker 容器无处不在(有充分的理由),让您的应用程序在容器上运行但同时在 IDE 中设置本地虚拟环境以运行测试等感觉很奇怪。
我想知道是否有办法利用 Docker 容器来实现这个目的?
我正在尝试测试我的控制器.在我试图测试update动作之前,一切都很好.
这是我的测试
require 'test_helper'
class BooksControllerTest < ActionController::TestCase
test "should not update a book without any parameter" do
assert_raises ActionController::ParameterMissing do
put :update, nil, session_dummy
end
end
end
Run Code Online (Sandbox Code Playgroud)
这是我的控制器
class BooksController < ApplicationController
(...)
def update
params = book_params
@book = Book.find(params[:id])
if @book.update(params)
redirect_to @book
else
render 'edit'
end
end
(...)
def book_params
params.require(:book).permit(:url, :title, :price_initial, :price_current, :isbn, :bought, :read, :author, :user_id)
end
end
Run Code Online (Sandbox Code Playgroud)
我的应用程序的书籍控制器的路线如下:
books GET /books(.:format) books#index
POST /books(.:format) books#create
new_book GET /books/new(.:format) books#new
edit_book …Run Code Online (Sandbox Code Playgroud)