小编Joh*_*des的帖子

即使未启用加密,PHPMailer也会使用TLS发送

我正在尝试使用没有TLS的PHPMailer发送电子邮件,但PHPMailer仍尝试使用TLS发送电子邮件,即使我不启用它:

include_once("PHPMailer-master\PHPMailerAutoload.php");

$To = 'some@site.com';
$Subject = 'Topic';
$Message = 'msg test';

$Host = 'site.com.br';
$Username = 'contact@site.com.br';
$Password = 'pass';
$Port = "587";

$mail = new PHPMailer();
$body = $Message;
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = $Host; // SMTP server
$mail->SMTPDebug = 1; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
//$mail->SMTPSecure = 'ssl'; //or tsl -> switched …
Run Code Online (Sandbox Code Playgroud)

php phpmailer

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

Spring Boot DevTools无法在Eclipse中运行

我使用Spring,JPA,MySQL和Web构建了一个应用程序.我正常在模板文件夹中开发了一个静态页面,它可以工作.

但是,当我在静态页面上更改某些内容时,我无法通过更改重新加载它.然后,我打开pom.xml并添加

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)

我重新启动应用程序,但是,当我在静态页面上进行一些更改时,仍然无法正常工作.

还有什么可以做的吗?

我的POM.xml

<?xml version="1.0" encoding="UTF-8"?>
<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.engsoftware</groupId>
    <artifactId>cobranca</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>Cobranca</name>
    <description>Demo project for Spring Boot</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.2.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

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

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

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

    <build>
        <plugins> …
Run Code Online (Sandbox Code Playgroud)

java eclipse maven spring-boot spring-boot-devtools

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

Spring 5 - 如何提供静态资源

我正在尝试在我的Web应用程序中提供静态资源,我试过:

@SuppressWarnings("deprecation")
@Bean
WebMvcConfigurerAdapter configurer(){
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addResourceHandlers (ResourceHandlerRegistry registry) {
            registry.addResourceHandler("/**").
                      addResourceLocations("classpath:/static/");
        }
    };
}
Run Code Online (Sandbox Code Playgroud)

但是在Spring 5中不推荐使用WebMvcConfigurerAdapter.如何立即访问静态资源?

java resources spring spring-mvc spring-webflux

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