我已经尝试过自动装配SpringBootConfiguration,但是在我的测试项目中什么也没找到。在执行一些测试之前,我需要检查在application-dev.properies中添加的字段,并查看其正确还是错误。
答案 0 :(得分:0)
有人回答过:
Where and How To Define An Application Property? - JHIpster
但是请注意取消注释
package com.example.empireuslforms;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class GeneralEmailActivity extends AppCompatActivity {
public EditText mEmailText;
public Button mSendEmail;
public TextView mUserName;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_general_email);
mUserName = (TextView)findViewById(R.id.tvUser);
mEmailText = (EditText)findViewById(R.id.etEmailText);
mSendEmail = (Button)findViewById(R.id.btnEmailSend);
mSendEmail.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
sendMail();
}
});
}
private void sendMail() {
String user_name = mUserName.getText().toString();
String mail = "email@email.com";
String message = "From: " + user_name + "\n" + mEmailText.getText().toString();
String subject = "Empire Forms App Contact";
//Send Email
JavaMailAPI javaMailAPI = new JavaMailAPI(this, mail, subject, message);
javaMailAPI.execute();
}
}
在属性文件中。并且最好创建一个对象,并确保自己实例化该对象,因此它不为null。如图所示,它应该是最终对象。