小编mag*_*omi的帖子

如何在IntelliJ Idea的项目树中立即看到编译错误?

我想知道是否可以配置IntelliJ Idea来立即显示项目树中类文件的编译错误.目前,如果无法编译类,我需要手动触发重新编译以查看我的类上的错误标记.

java appearance intellij-idea

124
推荐指数
3
解决办法
5万
查看次数

maven tomcat7:部署失败,访问被拒绝

我有一个tomcat7.访问管理器应用程序(http:// localhost:7777/manager/html)可以使用tomcat-users.xml中定义的凭据正常工作.

现在我想用maven3部署一个应用程序.我配置了tomcat maven插件:

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.0-beta-1</version>
    <configuration>
        <url>http://localhost:7777/manager</url>
        <server>localhost7777</server>
    </configuration>
</plugin>
<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat6-maven-plugin</artifactId>
    <version>2.0-beta-1</version>
    <configuration>
        <url>http://localhost:7777/manager</url>
        <server>localhost7777</server>
    </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)

在mavens setting.xml中,我添加了服务器的条目:

<servers>
    <server>
        <id>localhost7777</id>
        <username>manager</username>
        <password>secret</password>
    </server>
</servers>
Run Code Online (Sandbox Code Playgroud)

现在应用程序将成功构建.但目标tomcat7:deploy导致tomcat发出访问被拒绝错误消息:

...
[INFO] Deploying war to http://localhost:7777/workload-monitor  
Uploading: http://localhost:7777/manager/deploy?path=%2Fworkload-monitor&update=true
Uploaded: http://localhost:7777/manager/deploy?path=%2Fworkload-monitor&update=true (2329 KB at 55435.1 KB/sec)

[INFO] <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
[INFO] <html>
[INFO]  <head>
[INFO]   <title>403 Access Denied</title>
[INFO]   <style type="text/css">
[INFO]     <!--
...
Run Code Online (Sandbox Code Playgroud)

有人可以给我一个暗示吗?

maven-3 maven tomcat7

10
推荐指数
2
解决办法
7998
查看次数

使用Spring Data Rest时如何从组件扫描中排除@Repository

在Spring启动项目中,我有问题从组件扫描中排除一些存储库.

我有一个包含一些实体和一些存储库(JpaRepositories)的库.出于某种原因,我实现了一个小的Spring Boot Data Rest应用程序,该应用程序将用于为测试人员提供对实体的快速访问.因此,我实现了一个扩展PagingAndSortingRepository的存储库,并使用@RepositoryRestResource进行注释.

当应用程序启动时,将扫描所有存储库并使其可用.只要我只想让Data Rest存储库可用,我就注释了组件扫描程序以排除不想要的存储库.但这不起作用.我检查了执行器bean端点和我做的任何事情 - 没有排除存储库.

为了演示这个问题,我创建了一个简单的演示应用程序:https://github.com/magomi/springboot-restdata-repoloading.

为了排除DataRepository,我尝试了两种方法:

// exclude V02
@SpringBootApplication
@ComponentScan(excludeFilters = {
        @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {
                DataRepository.class})
})
Run Code Online (Sandbox Code Playgroud)

// exclude V01
@SpringBootApplication(exclude = { DataRepository.class })
Run Code Online (Sandbox Code Playgroud)

没有成功.当我调用/ beans端点(由弹簧启动器执行器提供)时,我总是看到

{
    bean: "dataRepository",
    aliases: [ ],
    scope: "singleton",
    type: "org.codefromhell.test.repoloading.DataRepository",
    ...
},
{
    bean: "dataApiRepository",
    aliases: [ ],
    scope: "singleton",
    type: "org.codefromhell.test.repoloading.api.DataApiRepository",
    ...
},
Run Code Online (Sandbox Code Playgroud)

spring-data spring-data-jpa spring-data-rest spring-boot

6
推荐指数
2
解决办法
4619
查看次数

多个模板旋转变压器为春季靴子上的百里香

我正在寻找一种方法来定义两个模板解析器,可以在spring boot应用程序中用于百万美元的邮件处理.我需要这个,因为我有一个html模板和一个文本模板.两者都是在电子邮件中提供富文本和纯文本内容所必需的.

所有配置都应在application.properties中或通过环境属性完成.

我只设法定义了一个模板解析器:

spring.thymeleaf.check-template-location=true
spring.thymeleaf.prefix=classpath:/mails/
spring.thymeleaf.excluded-view-names=
spring.thymeleaf.view-names=
spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=HTML5
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.content-type=text/html
spring.thymeleaf.cache=true
Run Code Online (Sandbox Code Playgroud)

如果有人能给我一个提示或向我展示寻找解决方案的正确方向,我会很高兴.

spring thymeleaf spring-boot

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

如何在java类注释中设置作者?

对于我们的内部开发,将java类的作者写入类注释是很常见的.

它将以.的形式写成

* @author Doe, John (john.doe@example.com)
Run Code Online (Sandbox Code Playgroud)

所有作者都将以此形式列出,在本课程中做得最多的人将首先列出.

我的问题:你如何处理这样的要求?您是在评论中设置作者身份还是使用源存储库来跟踪此信息?写作者姓名和电子邮件的最佳格式是什么?

java comments javadoc

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

IDEA挂起在远程调试端口上

我正在远程调试另一台服务器上的tomcat.Tomcat以以下参数(以及其他参数)启动:

-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5556
Run Code Online (Sandbox Code Playgroud)

在tomcat启动后,远程端口显示:

itadmin@srv-app02:~$ netstat -tulpen | grep java
tcp        0      0 0.0.0.0:5556            0.0.0.0:*               LISTEN      1000       2005708     30667/java      
tcp6       0      0 127.0.0.1:8005          :::*                    LISTEN      1000       2006491     30667/java 
....
Run Code Online (Sandbox Code Playgroud)

连接IDEA后,调试器似乎挂了.我没有得到有关成功连接到远程JVM的消息.

目前我不知道导致问题的原因.任何提示?

debugging tomcat jvm remote-debugging intellij-idea

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