我正在从事一个涉及为Zabbix进行查询的仪表板(SpringBoot + angular.js webapp)的创建的项目。为了进行测试,我安装了Ubuntu 16.04 LTS(VirtualBox),PostgreSQL 9.6,在其中我通过命令行导入了客户创建的数据库转储(pg_dump),还安装了GUI pgAdmin4并将其连接到我还原的db。
现在,我已经以这种方式安装了pgAdmin4:
作为根:
sudo apt-get install build-essential libssl-dev libffi-dev libgmp3-dev virtualenv python-pip libpq-dev python-dev
cd /opt/
mkdir enviromentpy
cd enviromentpy/
virtualenv pgadmin4
cd pgadmin4
source bin/activate
wget https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v2.1/pip/pgadmin4-2.1-py2.py3-none-any.whl
pip install pgadmin4-2.1-py2.py3-none-any.whl
touch lib/python2.7/site-packages/pgadmin4/config_local.py
echo "SERVER_MODE = False" >> lib/python2.7/site-packages/pgadmin4/config_local.py
Run Code Online (Sandbox Code Playgroud)
在发射之后
python lib/python2.7/site-packages/pgadmin4/pgAdmin4.py
Run Code Online (Sandbox Code Playgroud)
我看到以下输出:
pgAdmin4 started, go to http://127.0.0.1:5050 through your browser
Run Code Online (Sandbox Code Playgroud)
现在,如果我在上述地址启动Firefox,我会看到GUI,并且已经导入了postgres数据库
问题是:
1)如何正确停止服务?我的意思是pgAdmin GUI不是Postgres DBMS
2)要重新启动,请执行以下步骤:
cd /opt/enviromentpy
virtualenv pgadmin4
cd pgadmin4
source bin/activate
python lib/python2.7/site-packages/pgadmin4/pgAdmin4.py
Run Code Online (Sandbox Code Playgroud)
这是对的吗??
3)有时,一段时间不活动后,ubuntu冻结,无法进行任何活动,我只能通过virtualbox菜单关闭计算机。你知道为什么吗?
你能帮助我吗??
非常感谢
我有一个带有 Spring Boot 和 JSP 的 Maven Web 应用程序。我正在尝试导入 webjar 以在 JSP 上使用 bootstrap,我添加了对我的 pom 的依赖项(包括定位器),并将资源处理程序放在我的 webconfig 上:
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>3.3.7-1</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>3.1.1</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>webjars-locator</artifactId>
<version>0.30</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
现在我在我的 webconfig 上添加引用:
@Configuration
@EnableWebMvc
public class WebConfig implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry
.addResourceHandler("/webjars/**")
.addResourceLocations("/webjars/");
}
}
Run Code Online (Sandbox Code Playgroud)
然后我尝试将 jar 导入我的 JSP 中:
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>3.3.7-1</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>3.1.1</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>webjars-locator</artifactId>
<version>0.30</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
但这不起作用。我将 css 放入 webapp 文件夹中,但无法将其链接到 …
我正在使用SpringBoot 2.1.3并尝试通过命令行传递许多参数。
这是main课程:
@SpringBootApplication
@Slf4j
public class Application implements CommandLineRunner {
@Value("${priceOne.pound}")
private Integer p1pound;
@Value("${priceOne.shilling}")
private Integer p1shilling;
@Value("${priceOne.pences}")
private Integer p1pences;
@Value("${priceTwo.pound}")
private Integer p2pound;
@Value("${priceTwo.shilling}")
private Integer p2shilling;
@Value("${priceTwo.pences}")
private Integer p2pences;
@Value("${factor}")
private Integer factor;
@Value("${op}")
private String op;
public static void main(String[] args) {
SpringApplication.run(EurisApplication.class, args);
}
@Override
public void run(String... args) {
Price priceOne = new Price(p1pound, p1shilling, p1pences);
Price priceTwo = new Price(p2pound, p2shilling, p2pences);
....
....
}
Run Code Online (Sandbox Code Playgroud)
我尝试用以下内容填充这些变量: …
我正在重写一个大项目,SpringBoot 2.2.6但遇到了问题。
在旧的项目(纯ejb)当一个复杂的实体更新,代码生成entity从DTO's如下:
public Entity dtoToEntity(DTO dto) {
Entity entity = new Entity();
entity.setId(dto.getID());
// ecc...
// ecc...
entity.setSubEntity(dto.getSubEntity() != null ? new SubEntity(dto.getSubEntity().getId() : null);
// and so on
}
Run Code Online (Sandbox Code Playgroud)
重要的部分是与子实体相关的部分!在进行了类似旧项目调用的映射之后:
EntityManager.merge(entity);
Run Code Online (Sandbox Code Playgroud)
我认为通过合并调用,如果数据库内部存在具有指定 id 和其他字段valorized 的 SubEntity ,则其他字段保持有效并且不会设置为 null 因为它们没有在映射中声明。
但是SpringBoot我正在使用JpaRepository,如果我打电话,我认为不会发生同样的事情:
jpaRepository.save(entity);
Run Code Online (Sandbox Code Playgroud)
我认为通过此调用,具有指定 id 的 SubEntity 的其他字段将设置为 null!
这是正确的吗?
我能解决什么?
首先感谢您的回复!
你是对的,我不能做这样的事情,也不能用 EntityManager.merge() 方法!比我试图更好地解释我想要做什么:
假设我有一个复杂的实体,它有许多嵌套实体(可能有嵌套实体),如下所示:
@Entity
public class Car {
private String name;
....
.... …Run Code Online (Sandbox Code Playgroud)