小编Pra*_*oli的帖子

在当前项目和插件组中找不到前缀'spring'的插件

执行mvn spring之后得到以下错误:boot run:

[ERROR]在当前项目和插件组[org.apache.maven.plugins,org.codehaus.mojo]中找不到前缀'spring'的插件,可从存储库[local(/ path/to/local/repo)获得),spring-snapshots(http://repo.spring.io/snapshot),spring-milestones(http://repo.spring.io/milestone),central(https://repo.maven.apache.org/ maven2)] - > [帮助1]

我的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.example</groupId>
<artifactId>myproject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.0.BUILD-SNAPSHOT</version>
</parent>
<!-- Additional lines to be added here... -->
<!-- (you don't need this if you are using a .RELEASE version) -->
<repositories>
    <repository>
        <id>spring-snapshots</id>
        <url>http://repo.spring.io/snapshot</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>spring-milestones</id>
        <url>http://repo.spring.io/milestone</url>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>spring-snapshots</id>
        <url>http://repo.spring.io/snapshot</url>
    </pluginRepository>
    <pluginRepository>
        <id>spring-milestones</id>
        <url>http://repo.spring.io/milestone</url>
    </pluginRepository>

</pluginRepositories>
<dependencies>
    <!-- <dependency> <groupId>org.apache.maven.shared</groupId> …
Run Code Online (Sandbox Code Playgroud)

java spring maven spring-boot

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

如何使用java反射迭代Field类型List

我有一个名为User的类,它具有这样的Account类对象列表

 public class User{
   private List<Account> accounts = new ArrayList<Account>();
 }
Run Code Online (Sandbox Code Playgroud)

Account对象有一个瞬态字段,我想找到它并做一些事情

public class Account{
  private transient openDateInOrgDateFormat;
}
Run Code Online (Sandbox Code Playgroud)

这个字段我想找到使用反射,然后检查它的瞬态然后做什么.通过反射如何找到类型集合的字段然后迭代它并查找列表中的对象内的字段是否是瞬态的.

java reflection

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

@事务回滚在 Spring Boot 应用程序中不起作用?

我有一个要求,我需要将一些员工数据插入 db2 数据库,下面是代码:

@Log4j2
@Service
@Transactional
public class EmployeeServiceImpl extends EmployeeService{

@Autowired
private EmployeeDataRepository employeeDataRepository;

@Override
@Transactional(rollbackOn = {DataAccessException.class})
public void insertEmployeeData(List<Employee> employeeList){
 try{
     employeeDataRepository.insertEmployeeData(employeeList);
    }catch(DataAccessException ex){
      log.error("Exception whie inserting data in db {}",ex.getMessage());
    }
}
Run Code Online (Sandbox Code Playgroud)
@Log4j2
@Repository
public class EmployeeDataRepositoryImpl implements EmployeeDataRepository{

@Autowired
private DataSource dataSource;

@Value("${db.schema}")
private String schema;

@Override
public void insertEmployeeData(List<Employee> employeeList){
   this.jdbcInsert = new SimpleJdbcInsert(dataSource).withTableName("Employee");
   for(Employee emp : employeeList){
    Map<String,Object> parameters = new HashMap<String,Object>();
      parameters.put("name", emp.name);
      parameters.put("age", emp.age);
      parameters.put("dateOfJoining", emp.dateOfJoining);
      parameters.put("address", emp.address);
      parameters.put("salary", emp.salary);
      jdbcInsert.execute(parameters); …
Run Code Online (Sandbox Code Playgroud)

java spring spring-data spring-data-jpa spring-boot

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