小编Sha*_*mad的帖子

spring boot + apache camel + mongodb集成问题

刚开始,我是apache camel的新手.我有一个spring boot(MVC)+ mongodb项目已经运行正常,当我尝试将它与apache camel集成时,我在控制台上遇到异常.根据我对异常弹簧启动的理解,@Component当我@ComponentScan(basePackages="packagePath")在项目中的其他任何地方使用时,我试图说我不能在camel Route文件上使用默认注释,因为它是一个MVC架构,我有Controller,Service&Repository,我不能忽视,请帮我解决这个问题.

控制台例外

启动ApplicationContext时出错.要显示条件报告,请在启用"debug"的情况下重新运行应用程序.2018-03-15 17:17:55.426 ERROR 744 --- [main] osboot.SpringApplication
:应用程序运行失败

org.springframework.beans.factory.BeanDefinitionStoreException:无法处理配置类的导入候选[com.era.conf.ApplicationConfiguration]; 嵌套异常是java.lang.IllegalStateException:由于未找到org/springframework/boot/bind/RelaxedPropertyResolver,无法评估org.apache.camel.spring.boot.health.HealthCheckRoutesAutoConfiguration上的条件.确保您自己的配置不依赖于该类.(如果你把一个@ComponentScan在默认包错误EG)这也有可能发生,如果你是一个@ComponentScanning包springframework的在org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:616)〜[弹簧context-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.java:548)〜[spring-context-5.0.4.RELEASE.jar:5.0 .4.RELEASE]在org.springframework.context的org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:184)〜[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE] .annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:316)〜[弹簧上下文5.0.4.RELEASE.jar:5.0.4.RELEASE]在org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java: 233)〜[s 普林-上下文5.0.4.RELEASE.jar:5.0.4.RELEASE]在org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273)〜[弹簧上下文5.0.4.RELEASE.jar :5.0.4.RELEASE]在org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:93)〜[弹簧上下文5.0.4.RELEASE.jar:5.0.4.RELEASE]在org.springframework .context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:693)〜[弹簧上下文5.0.4.RELEASE.jar:5.0.4.RELEASE]在org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext. java:531)〜[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE] org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)~ [spring org.springfra中的-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE] orwork.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:388)中的mework.boot.SpringApplication.refresh(SpringApplication.java:752)[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE] org.springframework.boot.SpringApplication.run上的[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE](SpringApplication.java:327)[spring-boot-2.0.0.RELEASE.jar:2.0 .O.RELEASE] org.springframework.boot.SpringApplication.run(SpringApplication.java:1246)[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE] org.springframework.boot.SpringApplication.运行(SpringApplication.java:1234)[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE],位于com.era.conf.ApplicationConfiguration.main(ApplicationConfiguration.java:12)[classes /:na]引起:java.lang.IllegalStateException:由于未找到org/springframework/boot/bind/RelaxedPropertyResolver,无法评估org.apache.camel.spring.boot.health.HealthCheckRoutesAutoConfiguration上的条件.确保您自己的配置不依赖于该类.如果你是@ComponentScanning springframework包(例如,如果你错误地将@ComponentScan放在默认包中),org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:55)〜[[]在org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:109)〜[spring-context-5.0.4.RELEASE]中的spring-boot-autoconfigure-2.0.0.RELEASE.jar:2.0.0.RELEASE .jar:5.0.4.RELEASE]在org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:217)〜[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org .springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:606)〜[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE] ...省略了15个常见帧引起的:java.lang .NoClassDefFoundError:org.apache.camel.spring.boot.util.HierarchicalPropertiesEvalu中的org/springframework/boot/bind/RelaxedPropertyResolver ator.isEnabled(HierarchicalPropertiesEvaluator.java:49)〜[camel-spring-boot-2.20.2.jar:2.20.2] at org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator.evaluate(HierarchicalPropertiesEvaluator.java:42 )〜[camel-spring-boot-2.20.2.jar:2.20.2] org.apache.camel.spring.boot.util.GroupCondition.getMatchOutcome(GroupCondition.java:40)〜[camel-spring-boot- 2.20.2.jar:2.20.2] org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47)〜[spring-boot-autoconfigure-2.0.0.RELEASE.jar:2.0.0抛出java.lang.ClassNotFoundException:.RELEASE] ... 18个共同帧省略了致org.springframework.boot.bind.RelaxedPropertyResolver在java.net.URLClassLoader.findClass(URLClassLoader.java:381)〜[NA:1.8.0_102 ]在java.lang.ClassLoader.loadClass(ClassLoader.java:424)〜[na:1.8.0_102] at sun.misc.Launcher $ AppClassLoader.loadClass(Launcher.java:331)〜[na:1.8.0_102] at at java.lang.ClassLoader.loadClass(ClassLoader.java:357)〜[na:1.8.0_102] ... 22常见 帧被省略

POM

<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-mongodb</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-spring-boot-starter</artifactId>
            <version>2.20.2</version> …
Run Code Online (Sandbox Code Playgroud)

java spring-mvc apache-camel mongodb spring-boot

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

cvc-elt.1:找不到元素“beans”的声明 - Spring 4.0.2

虽然我尝试了很多方法来解决这个问题,但都没有成功。

我收到此错误“cvc-elt.1:在“dispatcher-servlet.xml”文件中找不到元素“beans”的声明。

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
    xmlns:beans="http://www.springframework.org/schema/beans"
    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">

    <context:component-scan base-package="com.b2b.controller" />

</beans>
Run Code Online (Sandbox Code Playgroud)

我的 pom.xml 文件是:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.b2b</groupId>
    <artifactId>b2b</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>b2b</name>
    <description>Blog to Blog</description>

    <!-- Plugin needs to be added in the project so that these will be available with the war file for ever. -->
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.2</version>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>

        </plugins>
    </build>

    <!-- Dependencies Version -->
    <properties>
        <springframework.version>4.0.2.RELEASE</springframework.version> …
Run Code Online (Sandbox Code Playgroud)

spring tomcat

6
推荐指数
1
解决办法
4518
查看次数

如何将进度条置于布局顶部

我在相对布局中包含了一个进度条,但是它在布局后面运行。有什么办法可以使它显示在页面加载时显示的前面。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:background="@color/pageBackgroundColor"
    android:gravity="center"
    tools:context="co.sd.app.CheckoutActivity">

    <ProgressBar
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:visibility="visible" />

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/relativeLayout"
        android:layout_marginLeft="@dimen/page_marging_left"
        android:layout_marginRight="@dimen/page_marging_right">

        <android.support.v7.widget.AppCompatTextView
            android:id="@+id/service_detail_cv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_below="@+id/shedule_apt_cv"
            android:layout_marginBottom="@dimen/dim_10sp"
            android:layout_marginTop="@dimen/dim_10sp"
            android:textColor="@color/darkGrey" />

    </RelativeLayout>

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

我不知道为什么会这样显示。

android relativelayout android-progressbar

6
推荐指数
1
解决办法
5036
查看次数

使用 swagger-springmvc(现在是 springfox)查看 swagger api-docs 时出现“404 Not Found”

我试图在我的 spring 项目中配置 swagger,但是点击“ http://localhost:8080/api-docs ”说“404 Not Found”。

Maven 依赖

<dependency>            
  <groupId>com.mangofactory</groupId>           
  <artifactId>swagger-springmvc</artifactId>                   
  <version>0.8.2</version>      
</dependency>
Run Code Online (Sandbox Code Playgroud)

SwaggerConfig.java 文件

package com.ucap.swagger;

import com.mangofactory.swagger.configuration.JacksonScalaSupport;
import com.mangofactory.swagger.configuration.SpringSwaggerConfig;
import com.mangofactory.swagger.configuration.SpringSwaggerModelConfig;
import com.mangofactory.swagger.configuration.SwaggerGlobalSettings;
import com.mangofactory.swagger.core.DefaultSwaggerPathProvider;
import com.mangofactory.swagger.core.SwaggerApiResourceListing;
import com.mangofactory.swagger.core.SwaggerPathProvider;
import com.mangofactory.swagger.scanners.ApiListingReferenceScanner;
import com.wordnik.swagger.model.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import static com.google.common.collect.Lists.newArrayList;

@Configuration
@ComponentScan(basePackages = "com.mangofactory.swagger")
public class SwaggerConfig {

    public static final List<String> DEFAULT_INCLUDE_PATTERNS = Arrays.asList("/news/.*");
    public static final String SWAGGER_GROUP = "mobile-api";

    @Value("${app.docs}")
    private …
Run Code Online (Sandbox Code Playgroud)

rest spring-mvc swagger swagger-ui

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

销毁所有碎片后显示空白活动

我创建了一个主要活动,其中有一个片段容器,我在导航菜单选项选择中替换其中的许多片段。它工作正常,但问题是:

  1. 当我单击导航项两次时,打开了两个相同的片段,我必须按两次后退按钮才能返回。
  2. 当所有片段在按下后被销毁时,我看到一个空白页面(我猜这可能是主活动页面)。

布局_main.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/main_activity_page"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/pageBackgroundColor"
    tools:context="co.sd.app.MainActivity">

    <RelativeLayout
        android:id="@+id/fragment_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <android.support.design.widget.NavigationView
        android:id="@+id/side_nav_drawer"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:padding="0sp"
        app:menu="@menu/side_navigation_menu" />

</android.support.v4.widget.DrawerLayout>
Run Code Online (Sandbox Code Playgroud)

主活动.java

public class MainActivity extends AppCompatActivity {

    private Bundle bundle;
    private SessionManager session;
    private DrawerLayout drawerLayout;
    private ActionBarDrawerToggle actionBarToggle;
    private TextView cartItemCountDisplay;
    private NavigationView sideNavView;
    private Menu sideNavViewMenu;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        drawerLayout = (DrawerLayout) findViewById(R.id.main_activity_page);
        actionBarToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.OPEN, R.string.CLOSE);

        drawerLayout.addDrawerListener(actionBarToggle);
        actionBarToggle.syncState();

        getSupportActionBar().setDisplayHomeAsUpEnabled(true); …
Run Code Online (Sandbox Code Playgroud)

android android-layout android-fragments

4
推荐指数
1
解决办法
497
查看次数

Eclipse无法在调试模式下启动tomcat-7服务器

我正在尝试调试我的代码,eclipse没有在调试模式下说明,但它在正常启动时工作正常.

以下是我在eclipse弹出窗口中获得的异常:

localhost上的服务器Tomcat v7.0服务器无法在90秒内启动.如果服务器需要更多时间,请尝试在服务器编辑器中增加超时.

当我查看控制台时,一切看起来都很好,请看看....

INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/security/oauth/details.xml]
Mar 11, 2015 11:48:38 AM org.springframework.core.io.support.PropertiesLoaderSupport loadProperties
INFO: Loading properties file from class path resource [dev/com.myPack.plat.data.mongo.config.props/mongo-config.properties]
Run Code Online (Sandbox Code Playgroud)

请帮帮我.

java eclipse tomcat7

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

GridView 显示重复项

我真的很惊讶,代码发生了什么,gridView 项目每次都在第 11 个位置显示重复,有时也在第 12 个位置显示重复。

在此处输入图片说明

您可以看到“桌面”网格已填充两次。

来自常量文件的网格图标和名称

public static final String[] values = {
            DESKTOP,
            LAPTOP,
            SERVER,
            PRINTER,
            NETWORK_SUPPORT,
            AIR_CONTITION,
            CCTV_CAMERA,
            ALL_IN_ONE_PC,
            HOME_CLEANING,
            APPLICANCE_REPAIR,
            ELECTRICITY,
            PLUMBING
    };

    public static final int[] images = {
            R.drawable.desktop_pc_icon,
            R.drawable.laptop_pc_icon,
            R.drawable.server_icon,
            R.drawable.printer_icon,
            R.drawable.network_support_icon,
            R.drawable.aircondition_icon,
            R.drawable.cctv_camera_icon,
            R.drawable.all_in_one_pc_icon,
            R.drawable.home_cleaning_icon,
            R.drawable.appliance_repair_icon,
            R.drawable.electrical_icon,
            R.drawable.plumbing_icon
    };
Run Code Online (Sandbox Code Playgroud)

网格采用者设置(在 onCreate 方法中)

 final GridView mainGrid = (GridView) findViewById(R.id.main_grid);
        mainGrid.setAdapter(new GridAdapter(MainActivity.this, AppConstants.productsId, AppConstants.values, AppConstants.images));
Run Code Online (Sandbox Code Playgroud)

电网适配器

public class GridAdapter extends BaseAdapter {

    private final String[] productsId;
    private final String[] values;
    private final int[] …
Run Code Online (Sandbox Code Playgroud)

android gridview android-adapter

2
推荐指数
1
解决办法
1246
查看次数

如何在Flex中计算10 ^ 5

我是新手,我很难知道如何计算10 ^ 5(10到5的功率).

如果这是一个Java代码,我会写的

但在这种情况下,我也没有在网上找到任何例子.

任何线索!

apache-flex actionscript-3

0
推荐指数
1
解决办法
113
查看次数