相关疑难解决方法(0)

Spring Boot ConflictingBeanDefinitionException:@Controller类的注释指定bean名称

我在Spring启动应用程序中不断收到ConflictingBeanDefinitionException错误.我不完全确定如何解决它,我有几个@Configuration注释类帮助建立Thymeleaf,Spring Security和Web.为什么应用程序试图设置homeController两次?(它在哪里尝试这样做?)

错误是:

org.springframework.beans.factory.BeanDefinitionStoreException: 
Failed to parse configuration class [org.kemri.wellcome.hie.Application]; nested exception is org.springframework.context.annotation.ConflictingBeanDefinitionException:
Annotation-specified bean name 'homeController' for bean class [org.kemri.wellcome.hie.HomeController] conflicts with existing, non-compatible bean definition of same name and class [org.kemri.wellcome.hie.controller.HomeController]
Run Code Online (Sandbox Code Playgroud)

我的spring boot主应用程序初始化程序:

@EnableScheduling
@EnableAspectJAutoProxy
@EnableCaching
@Configuration
@ComponentScan
@EnableAutoConfiguration
public class Application extends SpringBootServletInitializer {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @Override
    protected final SpringApplicationBuilder configure(final SpringApplicationBuilder application) {
        return application.sources(Application.class);
    }

}
Run Code Online (Sandbox Code Playgroud)

我的数据库配置文件:

@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(basePackages="org.kemri.wellcome.hie.repositories")
@PropertySource("classpath:application.properties")
public class DatabaseConfig {

  @Autowired
  private …
Run Code Online (Sandbox Code Playgroud)

java spring spring-mvc spring-security spring-boot

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

IntelliJ无法向Tomcat部署爆炸式战争

我有一个正在IntelliJ中开发并使用Apache Tomcat进行部署的Java Web应用程序。我定义了一些运行配置,这些配置在团队中的每个人之间共享。定义了这些运行配置,以将爆炸的战争工件部署到本地雄猫中。其他团队成员能够很好地部署和运行,但是出现以下错误:

Artifact Gradle : project : project.war (exploded): Error during artifact deployment. See server log for details.
Artifact Gradle : project : project.war (exploded): com.intellij.javaee.oss.admin.jmx.JmxAdminException: com.intellij.execution.ExecutionException: /IdeaProjects/project/build/libs/exploded/project.war not found for the web module.
Run Code Online (Sandbox Code Playgroud)

看来IntelliJ不想创建exploded/project.war目录。如果我手动创建这些目录,则不会收到该错误消息,但是所有WAR内容都不会放入该目录中。

我以为这可能是权限错误,所以我什至试图给我的项目目录777只是为了消除可能的问题。

有没有人遇到过这个问题?

我正在运行MacOS 10.12,并且过去已经能够进行部署,但是这个问题才刚刚开始。

谢谢

更新资料

IntelliJ日志实际上并没有显示任何其他错误,只是上述错误的完整StackTrace。

2017-11-02 11:20:52,896 [3777157]   INFO - erver.JavaeeServerInstanceImpl - com.intellij.execution.ExecutionException: <redacted>/build/libs/exploded/myproject.war not found for the web module. 
com.intellij.javaee.oss.admin.jmx.JmxAdminException: com.intellij.execution.ExecutionException: <redacted>/build/libs/exploded/myproject.war not found for the web module.
    at org.jetbrains.idea.tomcat.admin.TomcatAdminLocalServerImpl$DeployStep.perform(TomcatAdminLocalServerImpl.java:277)
    at org.jetbrains.idea.tomcat.admin.TomcatAdminLocalServerImpl.doDeploy(TomcatAdminLocalServerImpl.java:125)
    at com.intellij.javaee.oss.admin.jmx.JavaeeJmxAdminServerBase$4.doPerform(JavaeeJmxAdminServerBase.java:120)
    at com.intellij.javaee.oss.admin.jmx.JavaeeJmxAdminServerBase$JmxOperation.perform(JavaeeJmxAdminServerBase.java:243)
    at …
Run Code Online (Sandbox Code Playgroud)

intellij-idea

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

如何将build.gradle导入IntelliJ

注意:此处的完整源代码.

我使用Gradle Init插件创建了一个Scala库:

gradle init --type scala-library
Run Code Online (Sandbox Code Playgroud)

然后我修改它build.gradle以生成Gradle 2.13的包装器.然后我跑了:

gradle wrapper
Run Code Online (Sandbox Code Playgroud)

生成包装器.最后我跑了:

./gradlew clean idea
Run Code Online (Sandbox Code Playgroud)

我在IntelliJ社区中打开了这个项目.我修改了Library.scala(Gradle Init插件创建的)包含明显的Scala编译器错误,但注意到错误没有显示为红色下划线:

在此输入图像描述

然后我右键单击该src/main/scala目录,发现没有添加Scala源文件包的选项.或者任何JVM(.java等)文件:

在此输入图像描述

我认为Gradle Init插件存在缺陷(scala-library至少对于类型)或者Gradle IDEA插件存在缺陷.无论哪种方式,我想我在我的一个IntelliJ项目文件中遗漏了一些东西:

  • IML; 要么
  • 知识产权; 要么
  • IWS

任何想法我可以改变,以便IntelliJ显示编译器错误,以便我可以添加新的Scala源文件?

scala intellij-idea gradle

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