小编abh*_*bhi的帖子

@Autowired - 没有找到依赖于至少1个bean的类型的限定bean

目前,我在控制器和服务层之间的Autowire配置中遇到了问题.

我无法追查我的错误.

简单的日志信息

    SEVERE:   Exception while loading the app
    SEVERE:   Undeployment failed for context /OTT
    SEVERE:   Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: org.springframework.beans.factory.NoSuchBeanDefinitionException: 
No qualifying bean of type [com.ott.service.EmployeeService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
Run Code Online (Sandbox Code Playgroud)

下面我还给出了Controller和Service Layer代码以及dispatcher-servlet.xml

调节器

package com.ott.controller;

import com.ott.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

    /**
     *
     * @author SPAR
     */
    @Controller
    public class AdminController {

        private …
Run Code Online (Sandbox Code Playgroud)

spring spring-mvc spring-annotations

18
推荐指数
3
解决办法
11万
查看次数

管理URL的参数(Python Flask)

我想在我的网站上找到一些搜索功能.在输出页面中,我将所有结果都放在单页中.但是,我想将它分发到许多页面(即100次搜索/页面).为此,我在"urlfor"中传递了一些默认搜索,但它无效.我知道我犯了一个小错误,但我没有抓住它.

这是我的代码如下:

@app.route('/', methods=['GET', 'POST'])
def doSearch():
    entries=None
    error=None
    if request.method=='POST':
        if request.form['labelname']:
            return redirect(url_for('show_results',results1='0-100', labelname=request.form['labelname'] ))
        else:
            error='Please enter any label to do search'
    return render_template('index.html',entries=entries, error=error)




@app.route('/my_search/<labelname>')
def show_results(labelname=None, resultcount=None, results1=None):
    if not session.get('user_id'):
        flash('You need to log-in to do any search!')
        return redirect(url_for('login'))

    else:
        time1=time()
        if resultcount is None:
            total_count=g.db.execute(query_builder_count(tablename='my_data',nametomatch=labelname, isextension=True)).fetchall()[0][0]

        limit_factor=" limit %s ,%s"%(results1.split('-')[0],results1.split('-')[1])

        nk1=g.db.execute(query_builder(tablename='my_data',nametomatch=labelname, isextension=True) + limit_factor)
        time2=time()
        entries=[]
        maxx_count=None
        for rows in nk1:
            if maxx_count is None:
                maxx_count=int(rows[0])
            entries.append({"xmlname":rows[1],'xmlid':rows[2],"labeltext":rows[12]})
        return render_template('output.html', labelname=labelname,entries=entries, resultcount=total_count, time1=time2-time1, …
Run Code Online (Sandbox Code Playgroud)

python flask

16
推荐指数
1
解决办法
5万
查看次数

我的业力单元测试已执行但未停止(使用咕噜声)

我正在运行Karma来使用Grunt执行单元测试用例.它运行得非常好,但是在测试执行完成后,Karma进程不会自动停止.没有错误/没有日志.以下是config和grunt文件的详细信息.

卡玛 - config.js

module.exports = function(config) {
    config.set({
        // base path, that will be used to resolve files and exclude
        basePath: './../../../../',
        // frameworks to use
        frameworks: ['jasmine'],
        // generate js files from html templates
        preprocessors: {
            'ThemeLibrary/client/templates/categoryview/Category.html': 'ng-html2js'
        },
        // list of files / patterns to load in the browser
        files: [
            //Note: Order of file listing does matter therefore loading using * may cause issue
            //Load external libraries 
            'ThemeLibrary/client/js/vendor/others/underscore-min_1.6.0.js',
            'ThemeLibrary/client/js/vendor/jquery/jquery.min-1.9.1.js',
            'ThemeLibrary/client/js/vendor/angularjs/angular.min.js',
            'ThemeLibrary/client/js/vendor/angularjs/angular-resource.min.js',
            'ThemeLibrary/client/js/vendor/angularjs/angular-route.min.js',
            'ThemeLibrary/client/js/vendor/angularjs/keypress.js',
            'ThemeLibrary/client/js/vendor/angularjs/truncate.js',
            'Test/unit/client/lib/angularjs/angular-mocks.js',
            'Test/unit/client/lib/jasmin/JasminHelper.js', …
Run Code Online (Sandbox Code Playgroud)

angularjs gruntjs karma-runner

16
推荐指数
1
解决办法
1万
查看次数

Hibernate - 从多个表到一个对象的复杂查询

我有一个复杂的查询跨越7个表,并想知道如何在Hibernate中实现它.

我目前的尝试是使用session.createSQLQuery进行查询,我会将结果映射到特定实体.

我不知道如何做到这一点,因为过去我只使用一个表到一个实体.我需要在哪里指定我想使用可能跨越多个表的复杂查询?这只是在我的代码中吗?我的hbm.xml文件?我无法想到除了目前的尝试之外的任何其他事情.

这是我的查询示例:

String stringQuery = 
        "select  WI.Customer_Id, CU.Card, CU.Code, "+
                "PI.Identity_Card, PI.Name, PI.Surname, PI.Gender, "+
                "AD.Zip, AD.Geo_Lat, AD.Geo_Long, "+
                "CO.City_Geo_Level, "+
                "CU.Address_id, CA.Name, "+
                "CU.Category_Id, "+
                "CU.Status, "+
                "Sum(MO.Charged_Points) as Charged_Points, "+
                "Sum(MO.Total_Money) as Total_Money, "+
                "Count(MO.id) as AmountTransWinner "+
        "from Promotions_Winner WI "+ 
        "join Customers CU "+
          "on WI.Customer_id = CU.id "+
        "join Personal_Info PI "+
          "on CU.Personal_Info_Id = PI.id "+
        "join Address AD "+
          "on CU.Address_Id = AD.id "+
        "join Countries CO "+
          "on AD.country_id = …
Run Code Online (Sandbox Code Playgroud)

java sql hibernate

14
推荐指数
3
解决办法
4万
查看次数

在Intellij IDEA 12中创建一个Maven项目,但总是在"加载原型列表"页面中

我在IntelliJ IDEA 12中创建了一个Maven项目,完成了项目名称并按下"next",现在它显示了GroupId,ArtifactId和Version.但Maven原型并没有出现.它说

正在加载原型列表....

我可以按"完成",但创建的项目不是Web项目.

有没有人遇到过这种情况?

intellij-idea maven

14
推荐指数
1
解决办法
8378
查看次数

cvc-elt.1:找不到元素'beans'的声明

我试图获得一个bean对象来使用Spring Security验证用户登录功能:

    ApplicationContext context = new ClassPathXmlApplicationContext(
            "com/humandevice/drive/fx/util/applicationContext.xml");
    authenticationManager = (AuthenticationManager) context
            .getBean("authenticationManager");
Run Code Online (Sandbox Code Playgroud)

applicationContext.xml在下面:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans" 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.xsd
       http://www.springframework.org/schema/security
       http://www.springframework.org/schema/security/spring-security-3.2.xsd
       http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context.xsd"
xmlns:context="http://www.springframework.org/schema/context">
<context:component-scan base-package="com.humandevice.drive.fx">
    <context:include-filter type="regex"
        expression="com.humandevice.drive.fx.*" />
</context:component-scan>
<bean id="LoginController" alias="loginController" class="controller.LoginController">
    <property name="authenticationManager" ref="authenticationManager" />
    <property name="applicationContext" ref="applicationContext" />
</bean>
<bean id="applicationContext" alias="applicationContext"
    class="org.springframework.context.ApplicationContext;">
</bean>
<authentication-manager alias="authenticationManager">
    <authentication-provider user-service-ref="userService">
        <password-encoder ref="bCryptPasswordEncoder" />
    </authentication-provider>
</authentication-manager>
 </beans>
Run Code Online (Sandbox Code Playgroud)

但我得到这个例外:

Caused by: org.xml.sax.SAXParseException; lineNumber: 9; columnNumber: 64; cvc-elt.1: Cannot find the declaration of element …
Run Code Online (Sandbox Code Playgroud)

java spring spring-security

14
推荐指数
1
解决办法
7万
查看次数

使用flipclock.js从特定日期倒计时

我正在使用http://flipclockjs.com/

到目前为止这是我的调用脚本,

<script type="text/javascript">
var clock = $('.clock').FlipClock(3600 * 24 * 5, {
    clockFace: 'DailyCounter',
    countdown: true,
});
</script>
Run Code Online (Sandbox Code Playgroud)

请有人能告诉我如何从确切的日期算起来吗?

例如,日期是2014年7月21日在英国时间,并且访问该网站的每个人将根据当前日期查看到该日期剩余的时间.

javascript time date flipclock

13
推荐指数
3
解决办法
2万
查看次数

Docker:尝试连接时发生错误

在Windows上安装了Docker,另外还安装了2个Oracle VM VirualBox和Kitematic.我在Windows 10 PC中禁用了Hyper-V.现在的问题是我无法从DockerHub下载任何Docker镜像,甚至我也无法运行命令

Docker info
Run Code Online (Sandbox Code Playgroud)

在两端它显示以下错误.

尝试连接时发生错误:获取 http:// localhost:2375/v1.21/info:拨打tcp 127.0.0.1:2375:ConnectEx tcp:由于目标计算机主动拒绝连接,因此无法建立连接.

如果我在Docker QuickStart Terminal中运行它,它可以工作,但不能在PowerShell或MSBuild中工作.

docker dockerhub windows-10

13
推荐指数
1
解决办法
1万
查看次数

org.hibernate.MappingException:未知实体:

我真的想了解我的代码发生了什么.

我有一个独立的应用程序,它使用spring和Hibernate作为JPA,我试图使用一个主类运行测试

我的主要课程

package edu.acct.tsegay.common;

import edu.acct.tsegay.model.User;
import edu.acct.tsegay.business.IUserBusinessObject;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App {
    public static void main(String[] args) {
        try {
            ApplicationContext context = new ClassPathXmlApplicationContext(
                    "Spring3AndHibernate-servlet.xml");
            IUserBusinessObject userBusinessObject = (IUserBusinessObject) context
                    .getBean("userBusiness");

            User user = (User) context.getBean("user1");
            user.setPassword("pass");
            user.setUsername("tsegay");
            System.out.println(user.getPassword());

            userBusinessObject.delete(user);

            User user2 = new User();
            user2.setUsername("habest");
            user2.setPassword("pass1");
            System.out.println(user2.getPassword());
            /*
             * userBusinessObject.save(user2);
             * 
             * User user3 = userBusinessObject.searchUserbyId("tsegay");
             * System.out.println("Search Result: " + user3.getUsername());
             */
            System.out.println("Success");
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

} …
Run Code Online (Sandbox Code Playgroud)

java spring hibernate

12
推荐指数
1
解决办法
8万
查看次数

在JSP视图中,Spring 3.0.6 MVC @PathVariable和@RequestParam为空/空

我一直试图设置一个非常简单的控制器/视图,但是无法使其工作.在我web.xml,我已经定义了一个<servlet>名为servlet-context.xml,运行正常.在servlet-context.xml,我设置:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:mvc="http://www.springframework.org/schema/mvc"

<...other stuff in here... />

<mvc:annotation-driven />
Run Code Online (Sandbox Code Playgroud)

除其他事项外.我的理解是这就是使用@注释所需要的一切.

在我的控制器中,我有:

@RequestMapping(value="/student/{username}/", method=RequestMethod.GET)
public String adminStudent(@PathVariable String username, @RequestParam String studentid) {
    return "student";
}
Run Code Online (Sandbox Code Playgroud)

在我student.jsp看来,我有:

<p>This is the page where you would edit the stuff for ${username}.</p>
<p>The URL parameter <code>studentid</code> is set to ${studentid}.</p>
Run Code Online (Sandbox Code Playgroud)

当我发出请求时http://localhost:8080/application/student/xyz123/?studentid=456,我得到了我期望的视图,但所有变量都是空白或为空:

<p>This is the page where you would edit the stuff for .</p>
<p>The URL …
Run Code Online (Sandbox Code Playgroud)

spring spring-annotations spring-3

12
推荐指数
2
解决办法
7万
查看次数